[root@localhost tool]# tar -zxvf nacos-server-1.4.2.tar.gz -C /xz/
[root@localhost bin]# pwd
/xz/nacos/bin
[root@localhost bin]# sh startup.sh -m standalone
[root@localhost bin]# netstat -ntlp |grep 8848
tcp6 0 0 :::8848 :::* LISTEN 1485/java
//查看防火墙状态
systemctl status firewalld
//开启防火墙
systemctl start firewalld
//开放8848端口命令
firewall-cmd --zone=public --add-port=8848/tcp --permanent
//配置立即生效
firewall-cmd --reload
访问地址:http://192.168.3.20:8848/nacos/index.html
登录账号:nacos
密码:nacos
vim /lib/systemd/system/nacos.service
[Unit]
Description=nacos
After=network.target
[Service]
Type=forking
ExecStart=/xz/nacos/bin/startup.sh -m standalone
ExecReload=/xz/nacos/bin/shutdown.sh
ExecStop=/xz/nacos/bin/shutdown.sh
PrivateTmp=true
[Install]
WantedBy=multi-user.target
[root@localhost bin]# cd /lib/systemd/system
[root@localhost system]# chmod -R 775 nacos.service
systemctl daemon-reload
systemctl enable nacos.service
启动Nacos服务
systemctl start nacos.service
查看Nacos服务状态
systemctl status nacos.service
停止Nacos服务
systemctl stop nacos.service
[root@localhost bin]# pwd
/xz/nacos/bin
[root@localhost bin]# vim startup.sh
//添加如下内容
JAVA_HOME=/xz/java/jdk1.8.0_202/
[root@localhost system]# systemctl start nacos.service
[root@localhost system]# netstat -ntlp |grep 8848
//先备份application.properties为application.properties_back
cp application.properties application.properties_back
//然后编辑application.properties文件
vim application.properties
//最后在application.properties文件添加mysql数据源配置
spring.datasource.platform=mysql
db.num=1
db.url.0=jdbc:mysql://localhost:3306/nacos_config?characterEncoding=utf8&connectTimeout=1000&socketTimeout=3000&autoReconnect=true&serverTimezone=Asia/Shanghai
db.user=root
db.password=root
[root@localhost conf]# systemctl start nacos.service
访问地址:http://192.168.3.20:8848/nacos/index.html
登录账号:nacos
密码:nacos
版权说明 : 本文为转载文章, 版权归原作者所有 版权申明
原文链接 : https://wwwxz.blog.csdn.net/article/details/121519517
内容来源于网络,如有侵权,请联系作者删除!