当前位置:网站首页>Nacos集群搭建
Nacos集群搭建
2022-08-05 05:25:00 【用户昵称23】
Nacos集群搭建
一、前言
本文主要介绍如何搭建nacos集群,示例使用3台服务器进行搭建。
提示:以下是本篇文章正文内容,下面案例可供参考
二、安装准备
Nacos 基于 java 开发的,运行依赖于 java 环境。依赖 64 bit JDK 1.8+,请自行先安装jdk。
1、下载
nacos项目下载,因受网络的影响从github上下载较慢,可以gitee进行下载
git clone https://gitee.com/mirrors/Nacos.git
2、编译
在下载好的nacos根目录执行打开命令行,执行mvn -Prelease-nacos -Dmaven.test.skip=true clean install -U进行编译打包(需要安装maven环境),建议下载官方已经编译好的包,地址为:https://github.com/alibaba/nacos/releases/download/1.3.0/nacos-server-1.3.0.tar.gz。
拷贝nacos/distribution/target/nacos-server-1.3.0.tar.gz到服务器server1的/app目录下。
解压tar -zxf nacos-server-1.3.0.tar.gz。
三、修改相关配置
1.修改集群配置文件/app/nacos/conf/cluster.conf
#打开配置文件所在目录
cd /data/nacos/conf/
#修改集群配置文件名
mv cluster.conf.example cluster.conf
#修改集群配置
vim cluster.conf
10.18.10.148:8848
10.18.10.149:8848
10.18.10.150:8848
2.修改数据源配置文件/app/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://192.168.2.168:3306/nacos?characterEncoding=utf8&connectTimeout=1000&socketTimeout=3000&autoReconnect=true&useUnicode=true&useSSL=false&serverTimezone=UTC
db.user=nacos
db.password=nacos123
3、创建数据库nacos,创建帐号nacos/nacos123
CREATE USER 'nacos'@'%' IDENTIFIED BY 'nacos123';
GRANT ALL ON nacos.* TO 'nacos'@'%';
4、执行/app/nacos/conf/nacos-mysql.sql脚本
四、复制nacos到其他两台服务器
scp -r /app/nacos/ [email protected]:/app/
scp -r /app/nacos/ [email protected]:/app/
五、启动并登陆测试
1、启动3台服务器的nacos
执行以下命令启动nacos服务
sh /app/nacos/startup.sh
2、登陆测试,默认的账号密码nacos/nacos
http://10.18.10.148:8848/nacos
http://10.18.10.149:8848/nacos
http://10.18.10.150:8848/nacos

先自我介绍一下,小编13年上师交大毕业,曾经在小公司待过,去过华为OPPO等大厂,18年进入阿里,直到现在。深知大多数初中级java工程师,想要升技能,往往是需要自己摸索成长或是报班学习,但对于培训机构动则近万元的学费,着实压力不小。自己不成体系的自学效率很低又漫长,而且容易碰到天花板技术停止不前。因此我收集了一份《java开发全套学习资料》送给大家,初衷也很简单,就是希望帮助到想自学又不知道该从何学起的朋友,同时减轻大家的负担。添加下方名片,即可获取全套学习资料哦
边栏推荐
- 带你深入了解Cookie
- Q 2020, the latest senior interview Laya soul, do you know?
- LeetCode练习及自己理解记录(1)
- 网络排错基础-学习笔记
- Transformer详细解读与预测实例记录
- js判断文字是否超过区域
- Cocos Creator Mini Game Case "Stick Soldier"
- System basics - study notes (some command records)
- D46_Force applied to rigid body
- Tencent Internal Technology: Evolution of Server Architecture of "The Legend of Xuanyuan"
猜你喜欢

数组&的运算

selenium学习

Mina's long and short connections

From "dual card dual standby" to "dual communication", vivo took the lead in promoting the implementation of the DSDA architecture

What?CDN cache acceleration only works for accelerating static content?

What's the point of monitoring the involution of the system?

el-autocomplete使用

vs2017关于函数命名方面的注意事项

设置文本向两边居中展示

el-progress实现进度条颜色不同
随机推荐
Take you in-depth understanding of cookies
The future of cloud gaming
Difference between link and @improt
config.js相关配置汇总
What's the point of monitoring the involution of the system?
Into the pre-service, thought they play so flowers
用户和用户组管理、文件权限管理
network issue?Service packet loss?This is enough
What?CDN cache acceleration only works for accelerating static content?
js dynamically get screen width and height
NAT experiment
config.js related configuration summary
The use of three parameters of ref, out, and Params in Unity3D
King power volume LinkSLA, realize operations engineer is happy fishing
[ingress]-ingress使用tcp端口暴露服务
大小屏适配
Does flink cdc currently support Gauss database sources?
What is the website ICP record?
Configuration of routers and static routes
el-autocomplete使用