找到nacos-server-2.0.1.tar.gz 点击进行下载,下载完成后上传到服务器中。
方式二、使用wget命令下载
也有两种方式:第一种下载速度较慢
wget https://github.com/alibaba/nacos/releases/download/2.0.1/nacos-server-2.0.1.tar.gz
wget https://download.fastgit.org/alibaba/nacos/releases/download/2.0.1/nacos-server-2.0.1.tar.gz
2:创建mysql数据库
如下的操作步骤
A:在解压号的nacos文件夹下找到config文件夹
B:进入config文件夹,找到nacos-mysql.sql文件
C:将nacos-mysql.sql文件下载到本地,本地使用Navicat连接上mysql
D:使用Navicat在mysql中创建名为nacos的数据库,注意数据库名后面会用上.
3:修改数据库配置
进入到conf目录修改application.properties
vim application.properties
编辑端口号,注意端口号需要大于5001
### Default web context path:
server.servlet.contextPath=/nacos
### Default web server port:
server.port=9001
解开数据库的注释
### If use MySQL as datasource:
spring.datasource.platform=mysql
### Count of DB:
db.num=1
编辑数据库连接的地址,用于连接mysql数据库。账号和密码为mysql数据库密码。注意此处的mysql.xxx.tech:3306/nacos nacos为此前创建的数据库名。
### Connect URL of DB:
db.url.0=jdbc:mysql://mysql.xxx.tech:3306/nacos_prod?characterEncoding=utf8&connectTimeout=1000&socketTimeout=3000&autoReconnect=true&useUnicode=true&useSSL=false&serverTimezone=UTC
db.user.0=nacos
db.password.0=nacos
完整配置如下
#
# Copyright 1999-2018 Alibaba Group Holding Ltd.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
#*************** Spring Boot Related Configurations ***************#
### Default web context path:
server.servlet.contextPath=/nacos
### Default web server port:
server.port=9001
### Connection pool configuration: hik