Nacos2.3.2 在ubuntu下的部署
下载地址
https://download.nacos.io/nacos-server/nacos-server-2.3.2.zip
修改 application.properties文件
开启鉴权
### 开启鉴权功能
nacos.core.auth.caching.enabled=true
### The auth system to use, currently only 'nacos' and 'ldap' is supported:
nacos.core.auth.system.type=nacos
### 认证服务器的身份密钥
nacos.core.auth.server.identity.key=${自定义,保证所有节点一致}
### 认证服务器的身份密钥的值
nacos.core.auth.server.identity.value=${自定义,保证所有节点一致}
### 用于生成token的密钥
nacos.core.auth.plugin.nacos.token.secret.key=${自定义,保证所有节点一致}
开启token缓存
优点:由于token解析比较耗时,为了提升接口的性能,可以考虑开启缓存Token的功能,用字符串比较代替Token解析。
nacos.core.auth.plugin.nacos.token.cache.enable=true
配置mysql地址
# 指定为mysql,该属性不放开的话则默认使用内置数据源
spring.datasource.platform=mysql
### Count of DB:
db.num=1
### Connect URL of DB:
db.url.0=jdbc:mysql://192.168.99.105:3306/nacos_server?characterEncoding=utf8&connectTimeout=1000&socketTimeout=3000&autoReconnect=true&useUnicode=true&useSSL=false&serverTimezone=UTC
db.user.0=shushan
db.password.0=yourPassword
开启监控
management.endpoints.web.exposure.include=*
部署并运行 (单体模式)
### 解压
unzip /root/nacos-server-2.3.2.zip -d /usr/share/nacos-server
mv /usr/share/nacos-server/nacos /usr/share/nacos-server/nacos2.3.2
cd /usr/share/nacos-server/nacos2.3.2/bin
bash startup.sh -m standalone
坑:
不能用openjdk,否则登录会报错 caused: Invalid key: javax.crypto.spec.SecretKeySpec
但是用oracle的jdk就可以,详情见
https://github.com/alibaba/nacos/issues/12097
和 https://juejin.cn/post/7288624193955315749
编写nacos.service
vim /etc/systemd/system/nacos.service
[Unit]
Description=Nacos Server
After=network.target
[Service]
Type=forking
ExecStart=/usr/share/nacos-server/nacos2.3.2/bin/startup.sh -m standalone
ExecStop=/usr/share/nacos-server/nacos2.3.2/bin/shutdown.sh
User=root
Restart=on-failure
[Install]
WantedBy=multi-user.target
授权
chmod +x /usr/share/nacos-server/nacos2.3.2/bin/startup.sh
chmod +x /usr/share/nacos-server/nacos2.3.2/bin/shutdown.sh
systemctl daemon-reload
systemctl start nacos.service
# 开机启动
systemctl enable nacos.service
标签:部署,Nacos2.3,share,nacos,auth,server,usr,ubuntu,### From: https://www.cnblogs.com/QGuo/p/18472069