Related Environment:

  • CentOS 7
  • JDK 1.8
  • Nacos – server 1.4.1

1. Obtain the installation package

Visit Nacos Github to obtain the latest installation package

2. Decompress the package and move it to the installation directory

Tar -zxvf nacos-server-1.4.1.tar.gz -c /usr/local/Copy the code

Configure the MySQL data source

Create a database, called nacos_config after using/usr/local/MySQL the client side nacos/conf/nacos – MySQL. SQL file, complete building work table.

Open the core configuration file application.properties in the Nacos server. The file path is as follows:

/usr/local/nacos/conf/application.properties
Copy the code

Positioning to 33 line spring. The datasource. Platform near the “source” configuration, the default data source configuration are # # comments, below comments removed according to the sample data.

#Set the database type
spring.datasource.platform=mysql

### Number of databases that can be configured with multiple data:
db.num=1

#Database connection information:Db. Url. 0 = JDBC: mysql: / / 127.0.0.1:3306 / nacos_config? characterEncoding=utf8&connectTimeout=1000&socketTimeout=3000&autoReconnect=true&useUnicode=true&useSSL=false&serverTime zone=UTC db.user.0=nacos_config db.password.0=passwordCopy the code

4. Set the cluster configuration

After configuring multiple Nacos services (at least three Nacos), run the following command to create a cluster configuration file:

cp /usr/local/nacos/cluster.conf.example /usr/local/nacos/cluster.conf
Copy the code

Configure cluster nodes in the file in the following format. Port 8848 is not configured by default

#it is ip
# example
192.168.16.101:8847
192.168.16.102
192.168.16.103
Copy the code

5, start,

/usr/local/bin /usr/local/bin /usr/local/bin /usr/local/bin

Run the following command to start the cluster

cd /usr/local/nacos
#Run in single-machine mode
bash startup.sh -m standalone
#Run in cluster mode
bash startup.sh
Copy the code

At this point, Nacos service after launch, to http://ip:port/nacos/index.html access Nacos management background