部署一个单机模式的Nacos
部署于Centos7系统,需要额外安装MySQL、JDK8+。
一. MySQL
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
|
wget http://dev.mysql.com/get/mysql57-community-release-el7-10.noarch.rpm yum localinstall mysql57-community-release-el7-10.noarch.rpm yum install mysql-community-server
systemctl start mysqld
grep password /var/log/mysqld.log
mysql -uroot -p')jm8BYphsfa>' alter user 'root'@'localhost' identified by '一个很复杂很安全的密码';
create database nacos_db;
|
二. JDK8+
不要忘记设置PATH、JAVA_HOME
三. Nacos
查找Nacos的最新的稳定包: https://github.com/alibaba/nacos/releases
1 2 3 4 5 6 7 8 9 10 11 12 13
| wget https://github.com/alibaba/nacos/releases/download/1.2.1/nacos-server-1.2.1.tar.gz
tar xzvf nacos-server-1.2.1.tar.gz
mv nacos /opt/
vi /opt/nacos/conf/application.properties
sh /opt/nacos/bin/startup.sh -m standalone
|
编辑Nacos的配置文件vi /opt/nacos/conf/application.properties
:
1 2 3 4 5 6 7 8
| spring.datasource.platform=mysql db.num=1
db.url.0=jdbc:mysql://127.0.0.1:3306/nacos_db?characterEncoding=utf8&connectTimeout=1000&socketTimeout=3000&autoReconnect=true
db.user=nacos_user db.password=nacos_passwd
|
启动单机模式的Nacos:
1
| sh /opt/nacos/bin/startup.sh -m standalone
|