Kubernetes 和 Docker 部署

NCache 完全支持 Kubernetes 的各种风格,包括 Azure Kubernetes Service (AKS)、AWS Elastic Kubernetes Server (EKS)、Google Kubernetes Engine (GKE)、Red Hat OpenShift Kubernetes 等。 NCache 也完全支持Docker。

Kubernetes
码头工人
Azure Kubernetes服务
弹性Kubernetes服务
红帽OpenShift
Google Kubernetes引擎
 

部署 NCache 在 Kubernetes 集群中

你可以部署 NCache 在 Kubernetes 集群中并访问它 NCache 既可以从 Kubernetes 内部运行的应用程序进行部署,也可以从外部进行部署。 您还可以管理和监控这些 NCache 从 Kubernetes 外部运行 Kubernetes 的集群。 下图展示了部署情况 NCache 在 Kubernetes 集群中。 此图在 Azure Kubernetes 服务、Amazon Elastic Kubernetes 服务、Google Kubernetes Engine (GKE)、Red Hat OpenShift Kubernetes 以及任何其他 Kubernetes 环境中都是相同的。

NCache Kubernetes 集群概念

以下是上述部署中需要理解的一些概念 NCache 在 Kubernetes 中。

  1. NCache 发现服务: 这是一个无头服务,允许 Kubernetes 集群内运行的应用程序访问 NCache 使用其 DNS 名称来服务器 Pod。 NCache 服务器 Pod 没有固定的 IP 地址,因为每次启动或重新启动 Pod 时都会分配该地址。 这就是为什么发现服务在帮助客户与客户交谈方面发挥着关键作用。 NCache 服务器 Pod。
  2. NCache 管理/监控网关: 需要网关服务来管理和监控 NCache 它从外部在 Kubernetes 集群内部运行。 所有管理/监控操作均通过此网关路由到 NCache 服务器 Pod。 网关可以配置为始终将流量发送到特定的 NCache 服务器 Pod 如此 NCache 管理中心可以从外部连接到它。
  3. NCache Kubernetes 运算符 (未来): NCache 提供一个操作员来处理许可证激活和停用内所有 Pod NCache 部署。 运营商知道 NCache 部署并激活特定数量的 NCache 提前获得仅限服务器的许可证,以便它可以将它们用作 NCache 服务器 Pod 已启动或重新启动。

支持的 Kubernetes 风格

  1. Azure Kubernetes Service (AKS): NCache 支持 AKS 部署。
    - 获取 YAML
    - AKS视频
    - AKS 文档
  2. AWS 弹性 Kubernetes 服务 (EKS): NCache 支持EKS部署。
    - 获取 YAML
    - EKS视频
    - EKS 文档
  3. 红帽 OpenShift Kubernetes: NCache 支持 OpenShift 部署。
    - 获取 YAML
    - OpenShift 视频
    - OpenShift 文档
  4. 谷歌 Kubernetes 引擎 (GKE): NCache 支持 GKE 部署。
    - 获取 YAML
    - GKE 视频
    - GKE 文档

码头工人支持

NCache 通过以下方式全面支持Docker。

1. Docker Hub 上的 Docker 镜像

  • - NCache Enterprise
    • .NET版本
    • 码头工人拉 alachisoft/ncache:最新的
    • 操作系统:Linux (Debian)、Windows Server Core 2019
    • Java版
    • 码头工人拉 alachisoft/ncache:最新的java
    • 操作系统:Linux (Ubuntu)、Windows Server Core 2019
  • - NCache Professional
    • 码头工人拉 alachisoft/ncache:最新专业
    • 操作系统:Linux (Debian)、Windows Server Core 2019
  • - NCache Open Source
    • 码头工人拉 alachisoft/ncache:开源服务器-5.0.4

2. 自定义 Docker 镜像的 Docker 文件

在大多数情况下,您只需使用标准的 Docker Image NCache 来自 Docker 集线器。 但是,在某些情况下,您可能希望创建一个自定义 Docker 映像,其中包含您自己的软件或标准操作系统软件的其他变体。

这方面的一个例子是 Linux 的风格。 NCache Docker Hub 上的 Docker Image 使用 Debian Linux,但您可能需要另一种风格的 Linux NCache 服务器; NCache 适用于多种 Linux 风格。 或者,您可能希望为您的应用程序服务器创建一个自定义 Docker 映像(NCache Client) 不仅包含您自己的应用程序,还包含 NCache 客户端软件。

在所有此类情况下, Alachisoft 为您提供各种 Dockerfile,您可以编辑和自定义这些文件以满足您的需求。

Dockerfiles NCache
以下是这些 Dockerfile 的一些示例,您可以对其进行编辑以创建自定义 Docker 映像。

Dockerfile 示例
这是典型的 Dockerfile 的方式“NCache Enterprise Windows Server Core 的服务器”看起来像。

# Setting base image for NCache.
FROM microsoft/dotnet-framework:4.7.2-runtime

# Setting work directory to copy setups and resources for configuring NCache.
WORKDIR /app

# Make sure that the 2 folders ("resources" and "setup") exist in the same directory as the Dockerfile.
# Make sure that "IPBinding.ps1" script resides in the "resources" folder.
# Make sure that Microsoft Visual C++ 2010 x64 Redistributable setup is placed in the "setup" folder. It can be downloaded from https://www.microsoft.com/en-us/download/details.aspx?id=14632.
# Make sure that NCache setup resides in the "setup" folder. It can be downloaded from http://www.alachisoft.com/download-ncache.html.
# Copying resources and setups into the work directory of the container.
COPY resources .
COPY setup .

# Exposing ports used by NCache for communication.
# Exposing the port at which NCache service will listen for incoming client connection requests.
EXPOSE 9800
# Exposing the port at which NCache service will listen for incoming management connection requests (NCache Manager, Monitor and Tools).
EXPOSE 8250
# Exposing the port at which Bridge service will listen for incoming connection requests from cache processes.
EXPOSE 9900
# Exposing the port at which Bridge service will listen for incoming Management connection requests (NCache Manager and Tools).
EXPOSE 8260

# Installing Microsoft Visual C++ 2010 x64 Redistributable (Prerequisite of NCache).
RUN vcredist_x64.exe /norestart /q

# Installing NCache setup.
# The parameter "INSTALLMODE" represents the NCache installation mode and has the following values:
# Rename this parameter to "EDITION" if you are building image for NCache version 4.8 or older.
#		Enterprise Server Install mode = "0"
#		Enterprise Remote Client Install mode = "3"
# The parameter "KEY" is the install key and is sent to user through e-mail once they download NCache setup. In case if user does not get a key, contact us at http://www.alachisoft.com/company/contact-us.html.
# The parameter "USERFIRSTNAME" represents the first name of the user.
# The parameter "USERLASTNAME" represents the last name of the user.
# The parameter "COMPANYNAME" represents the company the user works for.
# The parameter "EMAILADDRESS" represents the e-mail address of the user.
# The parameter "INSTALLDIR" represents the installation directory where NCache will be installed.
# the parameter "/qn" specifies that NCache will be installed silently without user interaction and will not prompt the user for anything.
RUN msiexec /i ncache.ent.x64.msi INSTALLMODE="0" KEY="XXXXXXXXXX" USERFIRSTNAME="John" USERLASTNAME="Smith" COMPANYNAME="Alachisoft" EMAILADDRESS="john@alachisoft.com" INSTALLDIR="C:\Program Files\NCache" /qn

# Currently, the IP during NCache installation is stored in the configuration files and it can not be made static at that point.
# However, the IP can be made static once the container is started.
# An IP Binding change task is scheduled to run when the container instance is started. This task replaces the IP with the actual IP assigned to the container.
# Creating one time executing IP Binding task that will change the IP in NCache Configuration files on the first time the container is started.
RUN schtasks /Create /TN IPBinding /SC ONSTART /TR "c:\WINDOWS\system32\WindowsPowerShell\v1.0\powershell.exe C:\app\IPBinding.ps1" /ru SYSTEM

# Entry point for the container, once all the required configurations have been made.
CMD start -Verbose

接下来做什么?

联系我们

联系电话
©版权所有 Alachisoft 2002 - 版权所有。 NCache 是 Diyatech Corp. 的注册商标。