Nuster 使用与启动教程

Nuster 使用与启动教程

【免费下载链接】nuster A high performance HTTP proxy cache server and RESTful NoSQL cache server based on HAProxy 【免费下载链接】nuster 项目地址: https://gitcode.com/gh_mirrors/nu/nuster

1. 项目介绍

Nuster 是一个基于 HAProxy 的高性能 HTTP 代理缓存服务器和 RESTful NoSQL 缓存服务器。它完全兼容 HAProxy,并且利用 HAProxy 的 ACL 功能提供基于请求、响应或服务器状态的细粒度缓存策略。

Nuster 的特点包括:

  • 作为 HTTP/TCP 负载均衡器,继承并完全兼容 HAProxy 的所有功能。
  • 支持 HTTPS 在前端和后端。
  • 支持 HTTP 压缩、重写和重定向。
  • 支持基于 HTTP 方法、URI、路径、查询、头部、cookies 等的缓存策略。
  • 支持缓存管理,包括缓存清除、缓存统计和缓存 TTL。
  • 作为 RESTful NoSQL 缓存服务器,支持 HTTP POST/GET/DELETE 请求来设置、获取和删除键/值对象。

2. 项目快速启动

下载

下载页面 下载稳定版本,或使用 git 克隆源代码:

git clone https://github.com/jiangwenyuan/nuster.git

构建

使用以下命令构建 Nuster:

make TARGET=linux-glibc USE_LUA=1 LUA_INC=/usr/include/lua5.3 USE_OPENSSL=1 USE_PCRE=1 USE_ZLIB=1
make install PREFIX=/usr/local/nuster

如果需要使用 pthread 库,请添加 USE_PTHREAD_PSHARED=1

配置

创建一个最小的配置文件 nuster.cfg

global
    nuster cache on data-size 100m
    nuster nosql on data-size 200m
    master-worker # since v3

defaults
    mode http

frontend fe
    bind *:8080
    #bind *:4433 ssl crt example.com.pem alpn h2,http/1.1
    use_backend be2 if { path_beg /_kv/ }
    default_backend be1

backend be1
    nuster cache on
    nuster rule img ttl 1d if { path_beg /img/ }
    nuster rule api ttl 30s if { path /api/some/api }
    server s1 127.0.0.1:8081
    server s2 127.0.0.1:8082

backend be2
    nuster nosql on
    nuster rule r1 ttl 3600

启动

使用以下命令启动 Nuster:

/usr/local/nuster/sbin/nuster -f nuster.cfg

使用 Docker

使用以下命令拉取和运行 Nuster 镜像:

docker pull nuster/nuster
docker run -d -v /path/to/nuster.cfg:/etc/nuster/nuster.cfg:ro -p 8080:8080 nuster/nuster

3. 应用案例和最佳实践

作为 HTTP 缓存服务器

Nuster 可以用作 HTTP 代理缓存服务器,缓存动态和静态 HTTP 响应。以下是一个缓存图片和 API 响应的示例:

backend be1
    nuster cache on
    nuster rule img ttl 1d if { path_beg /img/ }
    nuster rule api ttl 30s if { path /api/some/api }

作为 NoSQL 缓存服务器

Nuster 可以作为 RESTful NoSQL 缓存服务器,使用 HTTP POST/GET/DELETE 请求来操作键/值对象:

backend be2
    nuster nosql on
    nuster rule r1 ttl 3600

4. 典型生态项目

目前没有特定的典型生态项目列出。用户可以根据自己的需求,利用 Nuster 的高性能和灵活性来集成到现有的项目中,或者构建新的应用。

【免费下载链接】nuster A high performance HTTP proxy cache server and RESTful NoSQL cache server based on HAProxy 【免费下载链接】nuster 项目地址: https://gitcode.com/gh_mirrors/nu/nuster

创作声明:本文部分内容由AI辅助生成(AIGC),仅供参考

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值