centos 7.9上部署nacos 2.0.3
wget -P /opt/software/ https://github.com/alibaba/nacos/releases/download/2.0.3/nacos-server-2.0.3.tar.gz
cd /opt/software/
tar -zxf nacos-server-2.0.3.tar.gz
mv nacos /usr/local/
mysql -uroot -pmypwd111
DROP DATABASE nacos_config;
CREATE DATABASE nacos_config;
exit;
注:创建nacos用的库,库名:nacos_config
mysql -uroot -pmypwd111 -Dnacos_config < /usr/local/nacos/conf/nacos-mysql.sql
vim /usr/local/nacos/conf/application.properties
### Count of DB:
db.num=1
### Connect URL of DB:
#db.url.0=jdbc:mysql://127.0.0.1:3306/nacos?characterEncoding=utf8&connectTimeout=1000&socketTimeout=3000&autoReconnect=true&useUnicode=true&useSSL=false&serverTimezone=UTC
db.url.0=jdbc:mysql://127.0.0.1:3306/nacos_config?characterEncoding=utf8&connectTimeout=1000&socketTimeout=3000&autoReconnect=true&useUnicode=true&useSSL=false&serverTimezone=UTC
db.user.0=root
db.password.0=mypwd111
● db.num=1 去掉注释
●?db.url.0=jdbc:mysql://127.0.0.1:3306/nacos? 改为?db.url.0=jdbc:mysql://127.0.0.1:3306/nacos_config?? ,这里的3306/和问号?之间的就是你的nacos数据库名。
●?db.user.0=nacos 改为?db.user.0=root? ?你的mysql账号
●?db.password.0=nacos 改为?db.password.0=mypwd111 你的mysql密码
cd /usr/local/nacos/bin/
./startup.sh -m standalone # 启动单机模式nacos服务
./shutdown.sh # 关闭服务
cat > /etc/systemd/system/nacos.service <<EOF
[Unit]
Description=Nacos Service standalone
After=syslog.target network.target
[Service]
Environment="JAVA_HOME=/usr/local/jdk"
Type=forking
ExecStart=/usr/local/nacos/bin/startup.sh -m standalone
ExecReload=/usr/local/nacos/bin/shutdown.sh
ExecStop=/usr/local/nacos/bin/shutdown.sh
PrivateTmp=true
[Install]
WantedBy=multi-user.target
EOF
systemctl daemon-reload
systemctl enable nacos.service --now
http://192.168.10.79:8848/nacos/ ? ?(默认账号密码都是nacos)
三、(扩展)添加一条配置到nacos