当前位置:网站首页>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开发全套学习资料》送给大家,初衷也很简单,就是希望帮助到想自学又不知道该从何学起的朋友,同时减轻大家的负担。添加下方名片,即可获取全套学习资料哦
边栏推荐
猜你喜欢

BIO, NIO, AIO practical study notes (easy to understand theory)

config.js相关配置汇总

The hook of the operation of the selenium module

The highlight moment of operation and maintenance starts with intelligence

el-autocomplete使用

VRRP概述及实验

Alibaba Cloud Video on Demand

Take you in-depth understanding of cookies

Cloud Computing Basics - Study Notes

干货!教您使用工业树莓派结合CODESYS配置EtherCAT主站
随机推荐
Wireshark packet capture and common filtering methods
Successful indie developers deal with failure & imposters
DevOps-了解学习
[问题已处理]-jenkins流水线checkout超时
[问题已处理]-虚拟机报错contains a file system with errors check forced
通过反射获取Class对象的四种方式
设置文本向两边居中展示
From "dual card dual standby" to "dual communication", vivo took the lead in promoting the implementation of the DSDA architecture
从“双卡双待“到”双通“,vivo率先推动DSDA架构落地
浏览器存储WebStorage
Met with the browser page
LinkSLA insists that users come first and creates a sustainable operation and maintenance service plan
错误类型:反射。ReflectionException:无法设置属性“xxx”的“类”xxx”与价值“xxx”
el-autocomplete use
Operation and maintenance engineer, come and pick up the wool
Cloud Computing Basics - Study Notes
By solving these three problems, the operation and maintenance efficiency will exceed 90% of the hospital
Difference between link and @improt
transport layer protocol
Wechat applet page jump to pass parameters