nacos-server-2.2.1单机伪集群安装

一、下载&解压

二、配置集群:conf\cluster.conf

因为是在单机上部署,所以集群是伪集群。

# 在一台机器时必须保证端口号不能是连续的,真实机器时建议保持端口号一致
127.0.0.1:7740
127.0.0.1:7744
127.0.0.1:7748

三、配置数据连接

  • 初始化数据库脚本:conf\mysql-schema.sql
  • 配置数据库连接

 四、配置密钥

【ThisIsSongJianYongCustomSecretKey20130329】经过Base64 编码后的结果如下:

VGhpc0lzU29uZ0ppYW5Zb25nQ3VzdG9tU2VjcmV0S2V5MjAxMzAzMjk=

 注意必须是大于32个字符编码后的值!如果不配置该项,则会报如下错误信息:

2023-04-26 20:13:43,837 ERROR Error starting Tomcat context. Exception: org.springframework.beans.factory.UnsatisfiedDependencyException. Message: Error creating bean with name 'basicAuthenticationFilter' defined in class path resource [com/alibaba/nacos/prometheus/filter/PrometheusAuthFilter.class]: Unsatisfied dependency expressed through method 'basicAuthenticationFilter' parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'nacosAuthConfig' defined in URL [jar:file:/mnt/d/Tools/nacos-7740/target/nacos-server.jar!/BOOT-INF/lib/nacos-plugin-default-impl-2.2.1.jar!/com/alibaba/nacos/plugin/auth/impl/NacosAuthConfig.class]: Unsatisfied dependency expressed through constructor parameter 1; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'tokenManagerDelegate': Unsatisfied dependency expressed through field 'jwtTokenManager'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jwtTokenManager' defined in URL [jar:file:/mnt/d/Tools/nacos-7740/target/nacos-server.jar!/BOOT-INF/lib/nacos-plugin-default-impl-2.2.1.jar!/com/alibaba/nacos/plugin/auth/impl/token/impl/JwtTokenManager.class]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.alibaba.nacos.plugin.auth.impl.token.impl.JwtTokenManager]: Constructor threw exception; nested exception is java.lang.IllegalArgumentException: the length of secret key must great than or equal 32 bytes; And the secret key  must be encoded by base64.Please see https://nacos.io/zh-cn/docs/v2/guide/user/auth.html

所有配置完成后,拷贝出2份,将端口【server.port=7740】分别改为【server.port=7744】、【server.port=7748】,其它配置无需修改!

五、启动nacos集群

启动|关闭命令

# 启动命令
bin/startup.sh
# 关闭命令
bin/shutdwon.sh

 登录

http://localhost:7740/nacos 或 http://localhost:7744/nacos 或 http://localhost:7748/nacos

默认账号:nacos

默认密码:nacos

 至此,安装完毕!

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值