安装包下载地址:
https://github.com/alibaba/nacos/releases
测试环境单节点模式安装:
安装环境jdk8
方式ansible(自行解决)
下载的安装包:https://github.com/alibaba/nacos/releases/download/1.3.1/nacos-server-1.3.1.tar.gz
清除windows启动脚本
[root@nacos bin]# pwd
/data/software/nacos/bin
[root@nacos bin]# rm -rf *.cmd
[root@nacos bin]# ls
shutdown.sh startup.sh
启动:bin目录下 -m standalone 代表单节点模式启动
./startup.sh -m standalone
查看UI
http://192.168.1.*6:8848/nacos/
账号:nacos
密码:nacos
集群模式安装:(生产环境)
- 集群IP:
123.120.0.*9
123.120.0.*4
123.120.0.*5
- 数据库这次使用线上software-MySql
aliyun software数据库创建:
数据库名:nacos_config
账号:nacos
密码:6h***bH
数据库地址:*****
所有nacos节点执行:
[root@nacos01 install]# pwd
/data/install
wget https://github.com/alibaba/nacos/releases/download/1.3.1/nacos-server-1.3.1.tar.gz
tar zxvf nacos-server-1.3.1.tar.gz
[root@nacos01 install]# mv nacos /data/software/
//清除windows启动脚本
[root@nacos bin]# pwd
/data/software/nacos/bin
[root@nacos bin]# rm -rf *.cmd
//倒入数据库sql脚本数据:
/data/software/nacos/conf/nacos-mysql.sql
//application.properties配置文件
#*************** Config Module Related Configurations ***************#
### If use MySQL as datasource:
spring.datasource.platform=mysql
### Count of DB:
db.num=1
### Connect URL of DB:
db.url.0=jdbc:mysql://rm-2ze3qwssip2w0n02v.mysql.rds.aliyuncs.com:3306/nacos_config?characterEncoding=utf8&connectTimeout=1000&socketTimeout=3000&auto
Reconnect=true&useUnicode=true&useSSL=false&serverTimezone=UTC
db.user=nacos
db.password=6hL****H
#*************** CMDB Module Related Configurations ***************#
### The interval to dump external CMDB in seconds:
nacos.cmdb.dumpTaskInterval=3600
### The interval of polling data change event in seconds:
nacos.cmdb.eventTaskInterval=10
### The interval of loading labels in seconds:
nacos.cmdb.labelTaskInterval=300
### If turn on data loading task:
nacos.cmdb.loadDataAtStart=false
启动使用外部数据源:
sh startup.sh
检查每个节点的8848端口是否启动
进入UI: http://123.120.0.*9:8848/nacos
nginx——upstream配置
文件nacos.realdating.cn.conf
upstream nacos_cluster {
server 123.120.0.*9:8848;
server 123.120.0.*4:8848;
server 123.120.0.*5:8848;
}
server {
listen 80;
server_name nacos.aaaa.cn;
access_log /data/logs/nginx/access_nacos.log json;
charset UTF-8;
location /nacos/ {
proxy_http_version 1.1;
proxy_set_header Connection "";
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-for $proxy_add_x_forwarded_for;
proxy_pass http://nacos_cluster/nacos/;
}
网友评论