当前位置:网站首页>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开发全套学习资料》送给大家,初衷也很简单,就是希望帮助到想自学又不知道该从何学起的朋友,同时减轻大家的负担。添加下方名片,即可获取全套学习资料哦
边栏推荐
- Will intelligent operation and maintenance replace manual operation and maintenance?
- BIO,NIO,AIO实践学习笔记(便于理解理论)
- The hook of the operation of the selenium module
- 从“双卡双待“到”双通“,vivo率先推动DSDA架构落地
- BIO, NIO, AIO practical study notes (easy to understand theory)
- 多行文本省略
- network issue?Service packet loss?This is enough
- selenium learning
- vim教程:vimtutor
- What is the website ICP record?
猜你喜欢

Problems encountered in installing Yolo3 target detection module in Autoware

DisabledDate date picker datePicker

King power volume LinkSLA, realize operations engineer is happy fishing

传输层协议

selenium学习

Mina's long and short connections

disabledDate 日期选择器 datePicker

Into the pre-service, thought they play so flowers

Transformer interprets and predicts instance records in detail

前置++和后置++的区别
随机推荐
5分钟完成mysql离线安装
通过反射获取Class对象的四种方式
selenium learning
config.js相关配置汇总
ev加密视频转换成MP4格式,亲测可用
In-depth Zabbix user guide - from the green boy
The size of the screen adaptation
D39_Vector
H5 的浏览器存储
Passing parameters in multiple threads
time complexity and space complexity
浏览器存储WebStorage
人人AI(吴恩达系列)
Mina的长连接和短连接
Network wiring and digital-to-system conversion
7 steps to complete cloud monitoring
LeetCode刷题记录(2)
Mina disconnects and reconnects
[Problem has been resolved]-Virtual machine error contains a file system with errors check forced
ROS2下使用ROS1 bag的方法