linux之nacos安装

1:下载nacos安装包


方式一、进入官网下载压缩包
官网地址
在这里插入图片描述
在这里插入图片描述

找到nacos-server-2.0.1.tar.gz 点击进行下载,下载完成后上传到服务器中。
方式二、使用wget命令下载
也有两种方式:第一种下载速度较慢

wget https://github.com/alibaba/nacos/releases/download/2.0.1/nacos-server-2.0.1.tar.gz
wget https://download.fastgit.org/alibaba/nacos/releases/download/2.0.1/nacos-server-2.0.1.tar.gz

在这里插入图片描述

2:创建mysql数据库


如下的操作步骤
A:在解压号的nacos文件夹下找到config文件夹
B:进入config文件夹,找到nacos-mysql.sql文件
C:将nacos-mysql.sql文件下载到本地,本地使用Navicat连接上mysql
D:使用Navicat在mysql中创建名为nacos的数据库,注意数据库名后面会用上.

3:修改数据库配置


进入到conf目录修改application.properties

vim application.properties

编辑端口号,注意端口号需要大于5001

### Default web context path:
server.servlet.contextPath=/nacos
### Default web server port:
server.port=9001

解开数据库的注释

### If use MySQL as datasource:
spring.datasource.platform=mysql### Count of DB:
db.num=1

编辑数据库连接的地址,用于连接mysql数据库。账号和密码为mysql数据库密码。注意此处的mysql.xxx.tech:3306/nacos nacos为此前创建的数据库名。

### Connect URL of DB:
db.url.0=jdbc:mysql://mysql.xxx.tech:3306/nacos_prod?characterEncoding=utf8&connectTimeout=1000&socketTimeout=3000&autoReconnect=true&useUnicode=true&useSSL=false&serverTimezone=UTC
db.user.0=nacos
db.password.0=nacos

完整配置如下

#
# Copyright 1999-2018 Alibaba Group Holding Ltd.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
##*************** Spring Boot Related Configurations ***************#
### Default web context path:
server.servlet.contextPath=/nacos
### Default web server port:
server.port=9001### Connection pool configuration: hikariCP
db.pool.config.connectionTimeout=30000
db.pool.config.validationTimeout=10000
db.pool.config.maximumPoolSize=20
db.pool.config.minimumIdle=2
#*************** Network Related Configurations ***************#
### If prefer hostname over ip for Nacos server addresses in cluster.conf:
# nacos.inetutils.prefer-hostname-over-ip=false### Specify local server's IP:
# nacos.inetutils.ip-address=#*************** Config Module Related Configurations ***************#
### If use MySQL as datasource:spring.datasource.platform=mysql### Count of DB:db.num=1### Connect URL of DB:db.url.0=jdbc:mysql://mysql.xxx.tech:3306/nacos?characterEncoding=utf8&connectTimeout=1000&socketTimeout=3000&autoReconnect=true&useUnicode=true&useSSL=false&serverTimezone=UTCdb.user.0=nacosdb.password.0=nacos#*************** Naming Module Related Configurations ***************#
### Data dispatch task execution period in milliseconds: Will removed on v2.1.X, replace with nacos.core.protocol.distro.data.sync.delayMs
# nacos.naming.distro.taskDispatchPeriod=200### Data count of batch sync task: Will removed on v2.1.X. Deprecated
# nacos.naming.distro.batchSyncKeyCount=1000### Retry delay in milliseconds if sync task failed: Will removed on v2.1.X, replace with nacos.core.protocol.distro.data.sync.retryDelayMs
# nacos.naming.distro.syncRetryDelay=5000
### If enable data warmup. If set to false, the server would accept request without local data preparation:
# nacos.naming.data.warmup=true### If enable the instance auto expiration, kind like of health check of instance:
# nacos.naming.expireInstance=truenacos.naming.empty-service.auto-clean=true
nacos.naming.empty-service.clean.initial-delay-ms=50000
nacos.naming.empty-service.clean.period-time-ms=30000#*************** CMDB Module Related Configurations ***************#
### The interval to dump external CMDB in seconds:
# nacos.cmdb.dumpTaskInterval=3600### The interval of polling data change event in seconds:
# nacos.cmdb.eventTaskInterval=10### The interval of loading labels in seconds:
# nacos.cmdb.labelTaskInterval=300### If turn on data loading task:
# nacos.cmdb.loadDataAtStart=false#*************** Metrics Related Configurations ***************#
### Metrics for prometheus
management.endpoints.web.exposure.include=*
### Metrics for elastic search
management.metrics.export.elastic.enabled=false
#management.metrics.export.elastic.host=http://localhost:9200### Metrics for influx
management.metrics.export.influx.enabled=false
#management.metrics.export.influx.db=springboot
#management.metrics.export.influx.uri=http://localhost:8086
#management.metrics.export.influx.auto-create-db=true
#management.metrics.export.influx.consistency=one
#management.metrics.export.influx.compressed=true#*************** Access Log Related Configurations ***************#
### If turn on the access log:
server.tomcat.accesslog.enabled=true### The access log pattern:
server.tomcat.accesslog.pattern=%h %l %u %t "%r" %s %b %D %{User-Agent}i %{Request-Source}i
### The directory of access log:
server.tomcat.basedir=
#spring.datasource.platform=mysql
#db.num=1
#db.url.0=jdbc:mysql://10.101.167.27:3306/acm?characterEncoding=utf8&connectTimeout=1000&socketTimeout=10000&autoReconnect=true
#db.user=root
#db.password=root
#*************** Access Control Related Configurations ***************#
### If enable spring security, this option is deprecated in 1.2.0:
#spring.security.enabled=false### The ignore urls of auth, is deprecated in 1.2.0:
nacos.security.ignore.urls=/,/error,/**/*.css,/**/*.js,/**/*.html,/**/*.map,/**/*.svg,/**/*.png,/**/*.ico,/console-ui/public/**,/v1/auth/**,/v1/console/health/**,/actuator/**,/v1/console/server/**### 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=false
### worked when nacos.core.auth.system.type=ldap,{0} is Placeholder,replace login username
# nacos.core.auth.ldap.url=ldap://localhost:389
# nacos.core.auth.ldap.userdn=cn={0},ou=user,dc=company,dc=com### The token expiration in seconds:
nacos.core.auth.default.token.expire.seconds=18000### The default token:
nacos.core.auth.default.token.secret.key=SecretKey012345678901234567890123456789012345678901234567890123456789### 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=serverIdentity
nacos.core.auth.server.identity.value=security#*************** Istio Related Configurations ***************#
### If turn on the MCP server:
nacos.istio.mcp.server.enabled=false
#*************** Core Related Configurations ***************#### set the WorkerID manually
# nacos.core.snowflake.worker-id=### Member-MetaData
# nacos.core.member.meta.site=
# nacos.core.member.meta.adweight=
# nacos.core.member.meta.weight=### MemberLookup
### Addressing pattern category, If set, the priority is highest
# nacos.core.member.lookup.type=[file,address-server]
## Set the cluster list with a configuration file or command-line argument
# nacos.member.list=192.168.16.101:8847?raft_port=8807,192.168.16.101?raft_port=8808,192.168.16.101:8849?raft_port=8809
## for AddressServerMemberLookup
# Maximum number of retries to query the address server upon initialization
# nacos.core.address-server.retry=5
## Server domain name address of [address-server] mode
# address.server.domain=jmenv.tbsite.net
## Server port of [address-server] mode
# address.server.port=8080
## Request address of [address-server] mode
# address.server.url=/nacos/serverlist#*************** JRaft Related Configurations ***************#
### Distro data sync delay time, when sync task delayed, task will be merged for same data key. Default 1 second.
# nacos.core.protocol.distro.data.sync.delayMs=1000### Distro data sync timeout for one sync data, default 3 seconds.
# nacos.core.protocol.distro.data.sync.timeoutMs=3000### Distro data sync retry delay time when sync data failed or timeout, same behavior with delayMs, default 3 seconds.
# nacos.core.protocol.distro.data.sync.retryDelayMs=3000### Distro data verify interval time, verify synced data whether expired for a interval. Default 5 seconds.
# nacos.core.protocol.distro.data.verify.intervalMs=5000### Distro data verify timeout for one verify, default 3 seconds.
# nacos.core.protocol.distro.data.verify.timeoutMs=3000### Distro data load retry delay when load snapshot data failed, default 30 seconds.
# nacos.core.protocol.distro

4:进入bin目录启动nacos

sh startup.sh -m standalone

集群模式

sh startup.sh

ps:若是配置集群的话,需要修改cluster.conf.example
在里边添加其他节点的nacos的IP

5:期间遇到的问题


1.No DataSource set
问题描述:
在这里插入图片描述
问题原因:没有找到数据源,一般情况是application.properties中,配置的mysq连接有问题。
解决问题:核对第4步中的数据库配置,注意域名、数据库、mysql的账号密码是否正确。
2.java.io.IOException: Failed to bind
问题描述:
com.alibaba.nacos.core.distributed.raft.exception.JRaftException: java.io.IOException: Failed to bind
问题原因:绑定失败

解决问题:
方式一:查看nacos进程是否启动了多个进程,kill所有进程,再启动nacos

#查看nacos进程
ps aux|grep nacos
#kill进程
kill 进程id

方式二:由于端口号的问题,在第四步,编辑端口号,注意端口号需要大于5001。并保证该端口被开放,再启动nacos

#查询指定端口是否已开启
firewall-cmd --query-port=9001/tcp
#添加指定需要开放的端口: 
firewall-cmd --add-port=9001/tcp --permanent 
#重启防火墙 
firewall-cmd --reload 

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.xdnf.cn/news/145682.html

如若内容造成侵权/违法违规/事实不符,请联系一条长河网进行投诉反馈,一经查实,立即删除!

相关文章

圆柱包围框-Bounding Cylinder-原理-代码实现

定义:使用一个圆柱体包围点云的所有点,通常用于长柱状物体。 优点:适合于柱状或长条形的点云。 缺点:计算较为复杂,尤其是确定圆柱体的轴线方向和半径。 找到圆柱尽量满足下面条件 找到能够完全包围3D物体的最小圆柱…

户外无线麦克风哪个牌子好,降噪麦克风哪个牌子好,领夹麦推荐

对于热爱记录与户外直播的自媒体人来说,一款高性能的无线领夹麦克风决定了音频的质量。市场上虽有品牌如大疆、罗德、西圣等凭借技术创新引领潮流,但同时也存在一些产品,因设计缺陷在运动时声音捕捉不稳定。作为运动爱好者与音频设备测评师&a…

网络资源模板--Android Studio 图书借阅App

目录 一、项目演示 二、项目测试环境 三、项目详情 四、完整的项目源码 一、项目演示 网络资源模板--图书借阅App 二、项目测试环境 三、项目详情 首页 这段代码是一个 Android 应用的 MainActivity 类,功能简要总结如下: 1. **界面设置**&#xf…

数据结构不再难懂:带你轻松搞定图

数据结构入门学习(全是干货)——图 1 图 1.1 什么是图 图是一种用于表示多对多关系的数学模型。它由一组顶点和一组边构成,用于描述事物之间的复杂关联。 顶点:通常用 V (Vertex) 表示,代表事物或对象。边&#xf…

2024华为杯研赛E题保姆级教程思路分析

E题题目:高速公路应急车道紧急启用模型 今年的E题设计到图像/视频处理,实际上,E题的难度相对来说较低,大家不用畏惧视频的处理,被这个吓到。实际上,这个不难,解决了视频的处理问题,…

华为---代理ARP工作过程示例分析

目录 1. 示例场景 2. 基本配置 3. 配置代码 4. 测试验证 5. 抓包分析 5.1 在代理ARP环境下PC1和PC2通信分析 5.2 取消代理ARP环境下PC1和PC2通信分析 【1】取消R1路由器GE 0/0/1端口ARP代理 【2】取消R2路由器GE 0/0/1端口ARP代理 1. 示例场景 如上图所示,…

windows环境下配置MySQL主从启动失败 查看data文件夹中.err发现报错unknown variable ‘log‐bin=mysql‐bin‘

文章目录 问题解决方法 问题 今天在windows环境下配置MySQL主从同步,在修改my.ini文件后发现MySQL启动失败了 打开my.ini检查参数发现没有问题 [mysqld] #开启二进制日志,记录了所有更改数据库数据的SQL语句 log‐bin mysql‐bin #设置服务id&#x…

java重点学习-总结

十五 总结 https://kdocs.cn/l/crbMWc8xEZda (总结全部的精华) 1.面试准备 企业筛选简历规则简历编写注意事项(亮点)项目怎么找,学习到什么程度面试过程(表达结构、什么样的心态去找工作) 2.redis 缓存相关(缓存击穿、穿透、雪崩、缓存过期淘…

农业电商服务系统小程序的设计

管理员账户功能包括:系统首页,个人中心,会员管理,商家管理,商品分类管理,商品信息管理,农产品监督管理,助农信息管理,系统管理 微信端账号功能包括:系统首页…

使用Renesas R7FA8D1BH (Cortex®-M85)实现多功能UI

目录 概述 1 系统框架介绍 1.1 模块功能介绍 1.2 UI页面功能 2 软件框架结构实现 2.1 软件框架图 2.1.1 应用层API 2.1.2 硬件驱动层 2.1.3 MCU底层驱动 2.2 软件流程图 4 软件功能实现 4.1 状态机功能核心代码 4.2 页面功能函数 4.3 源代码文件 5 功能测试 5.1…

AI字幕翻译器行业分析:前五大厂商占有大约29.5%的市场份额

AI 字幕翻译器正在彻底改变我们使用不同语言消费媒体的方式,使内容可以普遍访问。这些先进的技术利用机器学习和自然语言处理,将口语对话实时翻译成字幕。这一功能不仅打破了语言障碍,提升了观众的体验,而且还使内容创作者能够毫不…

火语言RPA流程组件介绍--获取关联元素

🚩【组件功能】:获取指定元素的父元素、子元素、相邻元素等关联信息 配置预览 配置说明 目标元素 支持T或# 默认FLOW输入项 通过自动捕获工具捕获(选择元素工具使用方法)或手动填写网页元素的css,xpath,指定对应网页元素作为操作目标 关联…

Arthas jvm(查看当前JVM的信息)

文章目录 二、命令列表2.1 jvm相关命令2.1.3 jvm(查看当前JVM的信息) 二、命令列表 2.1 jvm相关命令 2.1.3 jvm(查看当前JVM的信息) 基础语法: jvm [arthas18139]$ jvmRUNTIME …

JUC 高并发编程的入门学习

课程内容概览 什么是 JUCLock 接口线程间通信集合的线程安全多线程锁Callable 接口JUC 三大辅助类: CountDownLatch CyclicBarrier Semaphore读写锁: ReentrantReadWriteLock阻塞队列ThreadPool 线程池Fork/Join 框架CompletableFuture 1 什么是 JUC 1.1 JUC 简介 在 Java …

小tips:MySQL中如何导出表中的数据(Navicat)

1.在Navicat中找出想要导出数据的表 2.将箭头放在目的表上,点击右键--->点击复制表--->点击结构和数据或者仅结构(根据需求选择需要复制的内容)

CertiK因发现Apple Vision Pro眼动追踪技术漏洞,第6次获苹果认可

​2024年9月20日,头部Web3.0安全机构CertiK自豪地宣布,CertiK的工程师因发现Apple Vision Pro MR(混合现实)头显设备中的关键漏洞而获得Apple公司认可,这已经是Apple公司第六次公开发布对CertiK的致谢,Cert…

JAVA自助高效安全无人台球茶室棋牌室系统小程序源码

​探索“自助高效安全无人台球茶室棋牌室系统”的奇妙之旅 🎱🍵🎲 🔍 初见惊艳:未来娱乐新体验 🔍 走进这家无人值守的台球茶室棋牌室,第一感觉就像是穿越到了未来!没有繁琐的前台登…

伊犁云计算22-1 ftp 配置

1 局域网搭建好 2 yum 编译好 开干 查看有没有安装vsftpd 加载iso 光盘

如何短期提高品牌声量?说几个有效策略

在如今竞争激烈的市场环境中,品牌声量成为了衡量一个品牌市场影响力的关键指标。一个强大的品牌声量不仅可以增加品牌的可见度,还能有效提升品牌的市场竞争力。但是,如何有效提升品牌声量,成为很多企业面临的挑战。首先我们要明确…

球形包围框-Bounding Sphere-原理-代码实现

定义:通过一个球体包围所有点云点,该球体的球心和半径由点云的分布决定,并且球体的半径尽可能小。优点:计算简单,通常用于快速粗略估计物体的范围。缺点:对于不规则形状的物体,包围不紧密&#…