Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to connect to mysql through deployment of nacos1.4 in docker

2025-03-29 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

In this issue, Xiaobian will bring you about how to connect mysql through the deployment of nacos1.4 in docker. The article is rich in content and analyzes and narrates from a professional perspective. After reading this article, I hope you can gain something.

Step 1: Create MySQL database nacos

Execute nacos initialization script directly

Step 2: Execute docker command

docker run -d ^-e MODE=standalone ^-e PREFER_HOST_MODE=hostname ^-e SPRING_DATASOURCE_PLATFORM=mysql ^-e MYSQL_SERVICE_HOST=192.168.1.104 ^-e MYSQL_SERVICE_PORT=3306 ^-e MYSQL_SERVICE_USER=root ^-e MYSQL_SERVICE_PASSWORD=root ^-e MYSQL_SERVICE_DB_NAME=nacos ^-p 8848:8848 ^--network bridge ^--name nacos1.4-mysql ^--restart=always ^--privileged=true ^nacos/nacos-server:1.4.0

Step 3: Using mysql8 requires modifying conf/application.properties in the container

Modify database connection append parameters for/home/nacos/conf/application.properties &allowPublicKeyRetrieval=true&serverTimezone=Asia/Shanghai

After modification, restart docker, see this log, indicating successful startup

Step 4: Visit nacos

Visit: 127.0.0.1:8848/nacos

Successful interface:

Step 5: Configure host locally

Because in the initialization steps provided, the connection between database and redis adopts host mode, so it is necessary to configure host locally.

# jeecgboot127.0.0.1 jeecg-boot-redis127.0.0.1 jeecg-boot-mysql127.0.0.1 jeecg-boot-nacos127.0.0.1 jeecg-boot-gateway127.0.0.1 jeecg-boot-system127.0.0.1 jeecg-boot-rabbitmq127.0.0.1 jeecg-boot-xxljob The above is how to connect mysql by deploying nacos1.4 in the docker shared by everyone. If you happen to have similar doubts, It may be understood in the light of the above analysis. If you want to know more about it, please pay attention to the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report