当前位置:网站首页>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开发全套学习资料》送给大家,初衷也很简单,就是希望帮助到想自学又不知道该从何学起的朋友,同时减轻大家的负担。添加下方名片,即可获取全套学习资料哦
边栏推荐
- Xiaodu Xiaodu is here!
- 多线程之传递参数
- Collection of error records (write down when you encounter them)
- Does flink cdc currently support Gauss database sources?
- 数组&的运算
- Seven Ways to Center a Box Horizontally and Vertically
- [ingress]-ingress exposes services using tcp port
- Q 2020, the latest senior interview Laya soul, do you know?
- 原生JS带你了解数组方法实现及使用
- js dynamically get screen width and height
猜你喜欢
随机推荐
媒体查询、rem移动端适配
DevOps process demo (practical record)
滚动条问题,未解决
浏览器兼容汇总
sql server duplicate values are counted after
CIPU, what impact does it have on the cloud computing industry?
Collection of error records (write down when you encounter them)
LeetCode刷题记录(2)
What is Alibaba Cloud Express Beauty Station?
May I ask how to read the binlog of the two tables of hologres through flink sql, and then how to join?
Introduction to Network Layer Protocols
RAID disk array
selenium learning
Quick question and quick answer - FAQ of Tencent Cloud Server
系统基础-学习笔记(一些命令记录)
BIO,NIO,AIO实践学习笔记(便于理解理论)
The use of three parameters of ref, out, and Params in Unity3D
数组&的运算
Mina断线重连
Network Protocol Fundamentals - Study Notes









