openEuler欧拉配置Nacos集群
一、安装Nacos
systemctl stop firewalld
systemctl disable firewalld
mkdir -p /home/nacos
tar xvf nacos-server-2.1.2.tar
mv nacos nacos8848
cd /home/nacos/nacos8848/conf/
在mysql中,执行mysql-schema.sql文件,生成表结构,然后建用户nacos,授权。
记得nacos密码使用native password模式,否则默认mysql8会报错哦!
create USER 'nacos'@'%' IDENTIFIED WITH 'mysql_native_password' BY '12341234+pQ';
grant all privileges on nacos.* to nacos@'%';
flush privileges;
vim /home/nacos/nacos8848/conf/application.properties ,修改数据库
db.num=1
db.url.0=jdbc:mysql://数据库地址:3306/nacos?characterEncoding=utf8&connectTimeout=1000&socketTimeout=3000&autoReconnect=true&useUnicode=true&useSSL=false&serverTimezone=UTC
db.user.0=nacos
db.password.0=数据库密码
cd /home/nacos/nacos8848/bin/ 启动
sh startup.sh -m standalone
ss -ntl | grep 8848
二、配置Nacos集群
vim /home/nacos/nacos8848/conf/cluster.conf
172.62.17.108:8848
172.62.17.108:8858
172.62.17.108:8868
cp -r nacos/ nacos8858
cp -r nacos/ nacos8868
vim nacos8858/conf/application.properties
server.port=8858
vim nacos8868/conf/application.properties
server.port=8868
三、配置Nacos开机启动
vim /etc/systemd/system/nacos8848.service ,剩下的两个也按此做一下
[Unit]
Description=nacos
After=network.target
[Service]
Type=forking
ExecStart=/home/nacos/nacos8848/bin/startup.sh
ExecReload=/home/nacos/nacos8848/bin/shutdown.sh
ExecStop=/home/nacos/nacos8848/bin/shutdown.sh
PrivateTmp=true
[Install]
WantedBy=multi-user.target
systemctl daemon-reload
systemctl enable nacos8848.service
systemctl start nacos8848.service
systemctl enable nacos8858.service
systemctl start nacos8858.service
systemctl enable nacos8868.service
systemctl start nacos8868.service
喜欢请赞赏一下啦^_^