Nacos集群版安装部署
Nacos集群部署文档
- 创建文件夹
mkdir -p /application
- 下载 Nacos
# 下载 nacos
wget https://github.com/alibaba/nacos/releases/download/1.4.2/nacos-server-1.4.2.tar.gz
# 解压缩
tar -zxvf nacos-server-1.4.2.tar.gz
# 移动到 /application 目录
mv nacos-server-1.4.2 /application/
```
-
配置 Nacos
修改 /application/nacos-server-1.4.2/conf/application.properties
# 上下文路径 server.servlet.contextPath=/nacos # 端口号 server.port=8848 # 本机IP地址 nacos.inetutils.ip-address=10.2.9.150 # 数据源 spring.datasource.platform=mysql jdbc.DriverClassName=com.mysql.cj.jdbc.Driver # 数据源数量 db.num=1 # 数据源连接配置 db.url.0=jdbc:mysql://10.2.9.151:3306/nacos_config?characterEncoding=utf8&connectTimeout=1000&socketTimeout=3000&autoReconnect=true&useUnicode=true&useSSL=false&serverTimezone=UTC db.user=nacos db.password=nacos nacos.naming.empty-service.auto-clean=true nacos.naming.empty-service.clean.initial-delay-ms=50000 nacos.naming.empty-service.clean.period-time-ms=30000 management.metrics.export.elastic.enabled=false management.metrics.export.influx.enabled=false # Tomcat accesslog配置 server.tomcat.accesslog.enabled=true # 日志格式 server.tomcat.accesslog.pattern=%h %l %u %t "%r" %s %b %D %{User-Agent}i # 日志路径 server.tomcat.basedir=/data/nacos/ ### The ignore urls of auth, is deprecated in 1.2.0: nacos.security.ignore.urls=/,/error,/**/*.css,/**/*.js,/**/*.html,/**/*.map,/**/*.svg,/**/*.png,/**/*.ico,/console-fe/public/**,/v1/auth/**,/v1/console/health/**,/actuator/**,/v1/console/server/** # The auth system to use, currently only 'nacos' is supported: nacos.core.auth.system.type=nacos # If turn on auth system: nacos.core.auth.enabled=false ### The token expiration in seconds: nacos.core.auth.default.token.expire.seconds=18000 ### The default token: nacos.core.auth.default.token.secret.key=SecretKey012345678901234567890123456789012345678901234567890123456789 ### Turn on/off caching of auth information. By turning on this switch, the update of auth information would have a 15 seconds delay. nacos.core.auth.caching.enabled=true #*************** Istio Related Configurations ***************# ### If turn on the MCP server: nacos.istio.mcp.server.enabled=false
修改 /application/nacos-server-1.4.2/conf/cluster.conf
10.2.9.150:8848
10.2.9.151:8848
10.2.9.152:8848
```
- Nacos 启动 /application/nacos-server-1.4.2/bin/startup.sh
-
Nacos 日志清理, 保留最近十五天的日志
编写shell脚本,自动清理日志
#!/bin/bash # 初始化 LOGS_PATH=/application/nacos-server-1.4.2/bin/logs for file in $LOGS_PATH/* do if test -f $file then echo $file #find $file -mtime +15 -name '*[0-9]*-[0-9]*-[0-9]*' | xargs rm -f else find $file -mtime +15 -name '*[0-9]*-[0-9]*-[0-9]*' | xargs rm -f fi done exit 0
添加脚本到 crontab 中, 每晚 00:00 自动执行, 清理 15 天之前的日志记录, 脚本
shell # 执行 crontab -e # 输入 1 0 * * * /data/nacos/log_rotate.sh
感谢您的反馈。如果您有关于如何使用 KubeSphere 的具体问题,请在 Slack 上提问。如果您想报告问题或提出改进建议,请在 GitHub 存储库中打开问题。
页面内容