Docker installation nacos2.2 detailed manual

Tip: After the article is written, the table of contents can be automatically generated. How to generate it can refer to the help document on the right


foreword

  • Nacos is the most important component in the SpringCloudAlibaba architecture.
  • Nacos is a dynamic service discovery, configuration, and service management platform that is easier to help build cloud-native applications. It provides three major functions: registry center, configuration center, and dynamic DNS service. Can seamlessly connect to popular frameworks such as Springcloud, Spring, Dubbo, etc.
  • nacos supports AP and CP mode switching, the default is AP mode, eureka only supports AP mode, zookeeper only supports CP mode

1. Nacos stand-alone installation

1. Download nacos image

The 2.2 version I use here, you can choose the corresponding version according to your needs

docker pull nacos/nacos-server:v2.2.0

2. Get the configuration file

Visit the official website: https://github.com/alibaba/nacos/releases
to download the corresponding version installation package
insert image description here

3. Modify the configuration file

You can use derby or mysql for persistence. Here I take mysql configuration as an example
to modify application.properties (I wrote it to death directly here, or you can specify the placeholder form when docker run, which is of little significance)
insert image description here
注:connectTimeout=10000&socketTimeout=30000,原配置是1000和3000,连接mysql会出现超时进而出现No DataSource set错误
占位符形式,数据库用户名配置可以写成db.user.0=$(MYSQL_SERVICE_USER:root)

4. Put the configuration file in the server nacos configuration path

insert image description here

I put it in the /opt/nacos directory here, and it will be mapped to the container when building the nacos container

5. Start the nacos container

docker run -d --name nacos -p 8848:8848 -p 9848:9848 -p 9849:9849 -e MODE=standalone -v /opt/nacos/logs/:/home/nacos/logs -v /opt/nacos/conf/:/home/nacos/conf/ --restart=always nacos/nacos-server

6. Visit the page

insert image description here


end

  • Thank you for your patience in reading. If you have any suggestions, please private message or comment.
  • If there is something to gain, please bother to support, follow, like, comment, and collect. The blogger will update it frequently and make progress together with everyone.

Guess you like

Origin blog.csdn.net/qq359605040/article/details/129066209