当前位置:首页 > 综合随写 > 正文内容

关于window版本nacos版本安装过程

admin2周前 (04-03)综合随写42
  • 环境

  • window10 16G 1TB

下载地址

  • window版本zip包 https://github.com/alibaba/nacos/releases/download/2.5.1/nacos-server-2.5.1.zip

  • Linux版tar包 https://github.com/alibaba/nacos/releases/download/2.5.1/nacos-server-2.5.1.tar.gz

安装前提

  安装jdk 1.8及以上,我安装了openJDK17 

  • 地址:https://github.com/adoptium/temurin17-binaries/releases

 安装过程

  1、解压压缩包

 

 

  2、启动方式

  默认配置为集群模式如果要直接启动方式有两种

  • 单机模式

    在bin目录下直接双击startup.cmd启动,但需要修改其中的内容,将set MODE="cluster"修改为set MODE="standalone";或者在cmd中进入到bin目录下使用命令“startup.cmd -m standalone”使用单机模式启动,-m的意思是使用指定模式启动。

  • 集群模式

    使用集群模式需要修改两个地方,首先先将conf中的cluster.conf.example复制一份然后重命名为cluster.conf,在其中按照下面的格式修改为自己的

  

...

    然后修改conf下的application.properties文件,集群其他机器也一样,除了db.num数字不同

#application.properties
#启动端口号
server.port=8848
#使用的类型
spring.sql.init.platform=mysql
#每台机子的ID,应该每台机子都不一样
db.num=1
#数据库持久化连接
db.url.0=jdbc:mysql://127.0.0.1:3306/nacos?characterEncoding=utf8&connectTimeout=1000&socketTimeout=3000&autoReconnect=true&useUnicode=true&useSSL=false&serverTimezone=Asia/Shanghai
db.user.0=root
db.password.0=123456

  如果需要安全性验证请根据下面的设置,集群其他机器也一样

### The auth system to use, currently only 'nacos' and 'ldap' is supported:
### 鉴权类型
nacos.core.auth.system.type=nacos

### If turn on auth system:
### 开启鉴权
nacos.core.auth.enabled=true

### Turn on/off caching of auth information. By turning on this switch, the update of auth information would have a 15 seconds delay.
### 开启缓存
nacos.core.auth.caching.enabled=true

### Since 1.4.1, Turn on/off white auth for user-agent: nacos-server, only for upgrade from old version.
nacos.core.auth.enable.userAgentAuthWhite=false

### Since 1.4.1, worked when nacos.core.auth.enabled=true and nacos.core.auth.enable.userAgentAuthWhite=false.
### The two properties is the white list for auth and used by identity the request from other server.
### 下面连个参数必填不填会出错,默认填写这个即可
nacos.core.auth.server.identity.key=example
nacos.core.auth.server.identity.value=example

### worked when nacos.core.auth.system.type=nacos
### The token expiration in seconds: 未开启token缓存,如需开启请根据官网参数修改,超时时间为默认
nacos.core.auth.plugin.nacos.token.cache.enable=false
nacos.core.auth.plugin.nacos.token.expire.seconds=18000
### The default token (Base64 String): 默认key随便填写,只要base64前的字符超过32位即可
### sPyFBvt@RGiwaVmxh3C7d$4EXsadhr31

 

   在bin目录下直接双击startup.cmd启动,其中的内容不需要改动,文件中的设置应该为set MODE="cluster"

  上面配置文件配置了持久化数据库,下面在mysql数据库中创建

CREATE DATABASE `nacos` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci */

 

  创建完成后执行在conf目录下的mysql-schema.sql数据库文件

  然后启动即可

  

  3、错误排除

  • Nacos:errCode: 102, errMsg: dataSource or tableName is null

    检查配置文件是否与我上面的一致,此问题一般是没有连接上持久化数据库导致,查看是否已经导入sql\

  • nacos启动报org.springframework.context.ApplicationContextException: Unable to start web server; nested exception is org.springframework.boot.web.server.WebServerException: Unable to start embedded Tomcat错误

    使用了集群模式但是没有配置上述配置,修改配置或者按照上述模式修改为单机模式即可


扫描二维码推送至手机访问。

版权声明:本文由XIAKEM发布,如需转载请注明出处。

本文链接:https://xiakem.cn/?id=17

分享给朋友:

“关于window版本nacos版本安装过程” 的相关文章

SpringBoot Controller接收参数的几种常用方式

第一类:请求路径参数1、@PathVariable获取路径参数。即url/{id}这种形式。2、@RequestParam获取查询参数。即url?name=这种形式例子GEThttp://localhost:8080/demo/123?name=suki_rong对应的java代码:@GetMapp...

Centos7系统备份与恢复

tar:  特点  1、保留权限  2、适合备份整个目录  3、可以选择不同的压缩方式  4、如果选择不压缩还能实现增量备份,部份还原,参考man tar dd  特点  1、对块进行操作,能备份整个硬盘(包括分区表、MBR,其他Linux不能很好支持的文件系统)  2、可以进行压缩(麻烦...

Mysql被黑客入侵及安全措施总结

Mysql被黑客入侵及安全措施总结

情况概述今天登陆在腾讯云服务器上搭建的 MySQL 数据库,发现数据库被黑了,黑客提示十分明显。MySQL 中只剩下两个数据库,一个是information_schema,另一个是黑客创建的PLEASE_READ,其中有一张info表,内容如下:Info: Your DB is Backed up...

IntelliJ IDEA常用快捷键

IntelliJ IDEA常用快捷键

之前开发项目一直用的是eclipse进行开发,近期在使用IDEA这个工具进行项目开发,之前在eclipse上能使用的快捷键方法放在IDEA上很多都不适用了,因此在此总结一下关于IDEA快捷键的使用方法:首先先说一下从IDEA上获取关于IDEA快捷键使用的方法步骤: 点击进去可以查看到所有快...

Linux中jar包启动和jar包后台运行

Linux 运行jar包命令如下:方式一:java -jar shareniu.jar特点:当前ssh窗口被锁定,可按CTRL + C打断程序运行,或直接关闭窗口,程序退出那如何让窗口不锁定? 方式二&代表在后台运行。特定:当前ssh窗口不被锁定,但是当窗口关闭...

什么是SpringCloud?个人理解

以前的服务器就好像,一个会语数外全能的老师,为学生提供服务,这个老师生病了,那全校停课。现在微服务流行后,学校有了数学教研组,语文教研组,外语教研组,每个教研组有一群老师具体负责某科的教学,缺了谁,学校都照样运转。而这个变化中,那些改变历史的程序员就是把一个服务器中的众多服务,或好几台服务器中的众多...

发表评论

访客

◎欢迎参与讨论,请在这里发表您的看法和观点。