稷然如此

  • 首页
  • 文章分类
    • AI
    • Android
    • Java
    • Shell
    • Vue
    • C#
    • Python
    • 数据库
    • 组件
    • 其他
    • Game
  • 常用命令
    • Docker
    • Git
    • Linux
  • 操作系统
    • CentOS
    • Ubuntu
    • Windows
    • Kylin
  • 工具
    • IntelliJ IDEA
    • Visual Studio Code
稷然如此
不积跬步,无以至千里
  1. 首页
  2. 文章分类
  3. Java
  4. 正文

CentOS 部署 Nacos

2023年7月10日 1064点热度 0人点赞

1.下载地址

https://github.com/alibaba/nacos/releases/tag/2.1.2

2.解压到指定目录并修改配置

修改conf/application.properties配置文件的数据库配置,去掉以下几个配置注释,设 置正确的数据库链接配置

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

# 如需放开鉴权,需要登陆的话,还需要修改以下配置
nacos.core.auth.enabled=true
nacos.core.auth.server.identity.key=akim
nacos.core.auth.server.identity.value=123456
# base64 字符串,自己生成
nacos.core.auth.plugin.nacos.token.secret.key=VGhpc0lzTXlDdXN0b21TZWNyZXRLZXkwMTIzNDU2Nzg=

[h2title]3.问题解决:

[/h2title]

1.libstdc++.so.6: cannot open shared object file: No such file or directory问题的解决:

1.安装libstdc++.so.6

yum whatprovides libstdc++.so.6

报以下内容接着第2步:

Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
libstdc++4.8.5-39.el7.i686 : GUN Standard C++ Library
Repo : base
Matched from:
Provides : libstdc++.so.6

2.安装libstdc++-4.8.5-39.el7.i686

yum install libstdc++-4.8.5-39.el7.i686

报以下错误内容接着第3步:

Loaded plugins: fastestmirror
                Loading mirror speeds from cached hostfile
                base | 3.6 kB  00:00:00
                epel | 5.3 kB  00:00:00
                extras | 2.9 kB  00:00:00
                updates | 2.9 kB  00:00:00
                (1/2): epel/x86_64/updateinfo | 1.0 MB  00:00:00
                (2/2): epel/x86_64/primary_db | 6.7 MB  00:00:00
                Resolving Dependencies
                --> Running transaction check
                ---> Package libstdc++.i686 0:4.8.5-39.el7 will be installed
                --> Processing Dependency: libgcc_s.so.1(GLIBC_2.0) for package: libstdc++-4.8.5-39.el7.i686
                --> Processing Dependency: libgcc_s.so.1(GCC_4.2.0) for package: libstdc++-4.8.5-39.el7.i686
                --> Processing Dependency: libgcc_s.so.1(GCC_3.3) for package: libstdc++-4.8.5-39.el7.i686
                --> Processing Dependency: libgcc_s.so.1(GCC_3.0) for package: libstdc++-4.8.5-39.el7.i686
                --> Processing Dependency: libgcc_s.so.1 for package: libstdc++-4.8.5-39.el7.i686
                --> Running transaction check
                ---> Package libgcc.x86_64 0:4.8.5-36.el7_6.2 will be updated
                ---> Package libgcc.i686 0:4.8.5-39.el7 will be installed
                ---> Package libgcc.x86_64 0:4.8.5-39.el7 will be an update
                --> Finished Dependency Resolution
                Error:  Multilib version problems found. This often means that the root
                       cause is something else and multilib version checking is just
                       pointing out that there is a problem. Eg.:

                         1. You have an upgrade for libstdc++ which is missing some
                            dependency that another package requires. Yum is trying to
                            solve this by installing an older version of libstdc++ of the
                            different architecture. If you exclude the bad architecture
                            yum will tell you what the root cause is (which package
                            requires what). You can try redoing the upgrade with
                            --exclude libstdc++.otherarch ... this should give you an error
                            message showing the root cause of the problem.

                         2. You have multiple architectures of libstdc++ installed, but
                            yum can only see an upgrade for one of those architectures.
                            If you don't want/need both architectures anymore then you
                            can remove the one with the missing update and everything
                            will work.

                         3. You have duplicate versions of libstdc++ installed already.
                            You can use "yum check" to get yum show these errors.

                       ...you can also use --setopt=protected_multilib=false to remove
                       this checking, however this is almost never the correct thing to
                       do as something else is very likely to go wrong (often causing
                       much more problems).

                       Protected multilib versions: libstdc++-4.8.5-39.el7.i686 != libstdc++-4.8.5-36.el7_6.2.x86_64

问题的关键出现在最后一句:Protected multilib versions: libstdc++-4.8.5-39.el7.i686 != libstdc++-4.8.5-36.el7_6.2.x86_64应该是版本库不一致吧,先更新一下64位的库,执行第3步

3.更新libstdc++-4.8.5-36.el7_6.2.x86_64

yum update libstdc++-4.8.5-36.el7_6.2.x86_64

更新完毕后,执行第4步

4.安装libstdc++.i686

yum install libstdc++.i686

4.手动启动

进入bin目录:

sh ./startup.sh -m standalone #单机部署

5.开机自启动

1.进入init.d目录

cd /etc/init.d

2.创建服务文件

vim nacos

3.编写脚本

脚本解释:

#chkconfig: 2345 63 37:

2345表示系统运行级别是2,3,4或者5时都启动此服务,20,是启动的优先级,80是关闭的优先级,如果启动优先级配置的数太小时如0时,则有可能启动不成功,因为此时可能其依赖的网络服务还没有启动,从而导致自启动失败。

脚本:

#!/bin/bash
#chkconfig: 2345 63 37
#description: nacos service
#processname: nacos-1.1.4
export JAVA_HOME=/usr/local/java/jdk1.8.0_333
export NACOS_HOME=/opt/nacos
case $1 in
		start)
			nohup $NACOS_HOME/bin/startup.sh -m standalone > /dev/null 2>&1 &
			echo "nacos is started"
			;;
		stop)
			$NACOS_HOME/bin/shutdown.sh
			echo "nacos is stopped"
			;;
		restart)
			$NACOS_HOME/bin/shutdown.sh
			echo "nacos is stopped"
			sleep 1
			nohup $NACOS_HOME/bin/startup.sh -m standalone > /dev/null 2>&1 &
			echo "nacos is started"
			;;
		*)
		echo "start|stop|restart"
		;;
esac
exit 0

4.修改文件权限:

chmod 777 nacos

5.添加或删除服务

添加:

chkconfig --add nacos

删除:

chkconfig --del nacos

6.启动、停止或重启服务

启动:

service nacos start

停止:

service nacos stop

重启:

service nacos restart

7.设置开启或关闭开机启动

开启:

chkconfig nacos on

关闭:

chkconfig nacos off

8.查看es进程,验证是否已启动

地址:http://localhost:8848/nacos

ps -ef | grep nacos
标签: CentOS Nacos
最后更新:2025年3月27日

Akim

犇 骉 Java、C#、Python、Go、Android、MiniProgram、Bootstrap、Vue2

点赞
下一篇 >
文章目录
  • 1.下载地址
  • 2.解压到指定目录并修改配置
  • 3.问题解决:
  • 4.手动启动
  • 5.开机自启动

Copyright © 2025 aianran.com All Rights Reserved.

免责申明 | 隐私政策 | 服务条款 | 关于我们

黔ICP备2023008200号-1

贵公网安备 52010202003594号