Docker 部署 NCache 软件

NCache 是一个速度极快且可扩展的 .NET 内存分布式缓存,它原生支持容器化环境。它可以帮助您解决数据库扩展瓶颈,并在高并发容器环境中线性扩展应用程序。您可以下载 Windows 安装程序。 (.msi) 并在 Windows 上安装。或者,您可以通过部署 NCache 在 Docker 容器中。

NCache Docker Hub 上的 Docker 镜像

行业标准入门方法 NCache 是获取一个预建的 NCache Docker 镜像 来自 Docker 集线器。 这些 Docker 镜像预装了 NCache它提供了一个即用型分布式缓存,在 .NET 密集型环境中性能优于传统的内存缓存解决方案。只需使用“docker pull”命令即可将其安装到您的环境中。这确保了与企业级 CI/CD 流水线的无缝集成。

NCache 在基于 Ubuntu 的 Linux 上以 Docker 镜像的形式提供。对于其他 Linux 版本,请使用 Docker 文件 提供 Alachisoft 并根据您喜欢的 Linux 版本进行修改。运行 NCache Docker 为 .NET 应用程序保留了其标志性的亚毫秒级延迟和线性可扩展性。

  • - NCache
    • docker pull alachisoft/ncache:最新

用于自定义 Docker 映像的 Docker 文件

在大多数情况下,预先构建的 NCache Docker Hub 上的镜像足以满足快速部署的需求。但在某些情况下,你可能需要创建一个 自定义 Docker 镜像 其中包括您自己的软件或标准操作系统软件的其他变体。

这方面的一个例子是 Linux 的风格。 NCache Docker Hub 上的 Docker Image 使用 Debian Linux,但您可能需要另一种风格的 Linux NCache 服务器; NCache 适用于多种 Linux 风格。 或者,您可能希望为您的应用程序服务器创建一个自定义 Docker 映像(NCache 客户端)不仅包含您自己的应用程序,还包含 NCache 客户端软件。这种方法可以优化容器启动时间,并确保开发和生产环境的一致性。

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

Dockerfiles NCache

您可以编辑以创建自定义 Docker 映像的这些 Dockerfile 的示例如下。

Dockerfile 示例

一个典型的 Dockerfile NCache NCache 服务器 它非常适合高流量微服务、ASP.NET Core 会话提供程序和实时发布/订阅消息传递。它的外观如下:

# Setting base image for NCache.
FROM ubuntu:22.04

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

# Make sure your machine has access to internet for installation of packages 
# Make sure that the folder ("resources") exist in the same directory as the Dockerfile.
# Make sure that "ipbinding.sh" script resides in the "resources" folder.
# Make sure that "installncache.sh" script resides in the "resources" folder.
# Make sure that NCache Linux setup (.tar.gz) resides in the "resources" folder. It can be downloaded from https://www.alachisoft.com/download-ncache.html.
# Copying resources and setups into the work directory of the container.
COPY resources .

# Exposing ports used by NCache for communication.
EXPOSE 8250-8260 9800 7800-7900 8300-8400 9900 10000-10100

# Installing prerequisite ...
RUN apt-get update && apt-get install -y \
 procps \
 ed \
 apt-transport-https \
 curl \
 libicu-dev \
 && rm -rf /var/lib/apt/lists/*
 
# Installing NCache Linux setup (.tar.gz).
# The parameter "--firstname" represents the first name of the user.
# The parameter "--lastname" represents the last name of the user.
# The parameter "--company" Provide your company name.
# The parameter "--email" Provide your email address.
# The parameter "--installkey" Installation key provided by alachisoft.com.
RUN  chmod -R 775 /app  \
 && ./installncache.sh --firstname "YOUR_FIRST_NAME" --lastname "YOUR_LAST_NAME" --company "YOUR_COMPANY" --email "YOUR_EMAIL" --installkey "******" --installmode "server"  \
 && rm -rf /var/lib/apt/lists/*

# Switching the current user to ncache user
USER ncache

# Entry point for the container, once all the required configurations have been made.
ENTRYPOINT ["/app/startup.sh"]

接下来做什么?

常见问题

行业标准的部署方式 NCache 在 Docker 中,可以通过使用 `docker pull alachisoft/ncache` 命令从 Docker Hub 拉取预构建镜像。这些镜像针对高性能 .NET 环境进行了优化,并同时支持 Linux(Ubuntu/Debian)和 Windows Server 容器。

是的。虽然 Docker Hub 上的默认镜像使用的是 Debian, Alachisoft 提供全面的 Dockerfile NCache这些可以进行定制,以支持其他 Linux 发行版,如 Red Hat 或 Alpine,从而确保环境一致性,并在 CI/CD 管道中加快容器初始化速度。

当然。 NCache 它旨在与 Kubernetes(AKS、EKS、GKE)和 Amazon ECS 等编排平台无缝集成。它支持动态集群和自动扩展,使其成为容器化微服务和高并发应用程序的理想分布式缓存解决方案。

运行 NCache Docker 框架保留了其标志性的亚毫秒级延迟。它允许通过向集群添加容器节点来实现线性扩展,从而解决了数据库扩展瓶颈问题,而无需像传统虚拟化那样产生额外的开销。

联系我们

联系电话

+1 214-619-2601 (美国)

+44 20 7993 8327 (英国)

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