当前位置:网站首页>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开发全套学习资料》送给大家,初衷也很简单,就是希望帮助到想自学又不知道该从何学起的朋友,同时减轻大家的负担。添加下方名片,即可获取全套学习资料哦
边栏推荐
- LeetCode practice and self-comprehension record (1)
- 初识网页与浏览器
- VLAN is introduced with the experiment
- Unity realizes first-person roaming (nanny-level tutorial)
- Cloud Computing Basics - Study Notes
- User and user group management, file permission management
- By solving these three problems, the operation and maintenance efficiency will exceed 90% of the hospital
- selenium学习
- config.js相关配置汇总
- Problems encountered in installing Yolo3 target detection module in Autoware
猜你喜欢
随机推荐
config.js related configuration summary
By solving these three problems, the operation and maintenance efficiency will exceed 90% of the hospital
The use of three parameters of ref, out, and Params in Unity3D
[问题已处理]-虚拟机报错contains a file system with errors check forced
Passing parameters in multiple threads
Proprietary host CDH
H5开发调试-Fiddler手机抓包
What impact does CIPU have on the cloud computing industry?
初识网页与浏览器
摆脱极域软件的限制
Mina's long and short connections
What should I do if the SSL certificate prompts that it is expired or invalid?
[Problem has been resolved]-Virtual machine error contains a file system with errors check forced
请问下通过flink sql读取hologres 的两张表的 binlog,然后如何进行join?
What?CDN cache acceleration only works for accelerating static content?
Autoware--Beike Tianhui rfans lidar uses the camera & lidar joint calibration file to verify the fusion effect of point cloud images
In-depth Zabbix user guide - from the green boy
7 steps to complete cloud monitoring
带你深入了解Cookie
GetEnumerator method and MoveNext and Reset methods in Unity