nacos-server-2.0.0 windows服务端
1、创建nacos数据库,并执行nacos/conf/nacos-mysql.sql文件初始化表结构与数据。
2、修改nacos/conf/application.properties配置数据相关信息
### If use MySQL as datasource:
spring.datasource.platform=mysql
### Count of DB:
db.num=1
### Connect URL of DB:
db.url.0=jdbc:mysql://127.0.0.1:3306/nacos?characterEncoding=utf8&connectTimeout=1000&socketTimeout=3000&autoReconnect=true&useUnicode=true&useSSL=false&serverTimezone=UTC
db.user.0=root
db.password.0=root
3、打开windos命令行,在bin目录下输入命令启动服务端
startup.cmd -m standalone
4、登陆nacos管理控制台http://localhost:8848/nacos/,默认用户密码:nacos/nacos
5、配置相关文件
6、客户端配置相关参数即可使用
spring:
application:
name: service1
profiles:
active: dev
cloud:
nacos:
config:
namespace: 14d29622-bf23-4d4a-b86d-cdedc18ff83b
file-extension: yaml
server-addr: 127.0.0.1:8848
ext-config[0]:
data-id: common-${spring.profiles.active}.yaml
refresh: true
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
<version>2.0.0.RELEASE</version>
</dependency>
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
<version>2.0.0.RELEASE</version>
</dependency>
网友评论