Docker 快速创建 Nacos 注册中心

简介: Docker 快速创建 Nacos 注册中心

       微服务中必不可少的组件可能就是注册中心了。注册中心的优点就不多说了,主要来看如何在 Docker 中搭建一个注册中心。


docker 中安装 Nacos

1、拉取镜像

[root@localhost ~]# docker pull nacos/nacos-server:2.0.32.0.3: Pulling from nacos/nacos-server
5ad559c5ae16: Pull complete
6119216bf5e5: Pull complete
49571fe4335c: Pull complete
91725161f3cf: Pull complete
53a8e3117049: Pull complete
8e310b7f7d64: Pull complete
181c5afae53f: Pull complete
a807caf8a203: Pull complete
58881861df40: Pull complete
21be4d5690b9: Pull complete
Digest: sha256:da74348293e1dbc489c07a48e0f170053ef7b22ec882e84e2254f190024bd996
Status: Downloaded newer image for nacos/nacos-server:2.0.3
docker.io/nacos/nacos-server:2.0.3


2、启动命令

[root@localhost ~]# docker run -d -e MODE=standalone -v /mydata/nacos/conf:/home/nacos/conf --name nacos -p 8848:8848 nacos/nacos-server:2.0.3
6f67c8be23f95cefbcc30ad5c211f0afa5d918283855431e4f8028dd24f18906

这里 Nacos 是以单机的方式启动的,这里并没有配置集群。


3、查看启动情况

[root@localhost ~]# docker psCONTAINER ID   IMAGE                      COMMAND                  CREATED         STATUS         PORTS
                                 NAMES
6f67c8be23f9   nacos/nacos-server:2.0.3   "bin/docker-startup.…"4 minutes ago   Up 4 minutes   0.0.0.0:8848->8848/tcp, :::8848->8848/tcp              nacos
6284d4089225   redis                      "docker-entrypoint.s…"4 days ago      Up 6 hours     0.0.0.0:6379->6379/tcp, :::6379->6379/tcp              mall-redis
4f6de6ccec9f   mysql:5.7                  "docker-entrypoint.s…"4 days ago      Up 6 hours     0.0.0.0:3306->3306/tcp, :::3306->3306/tcp, 33060/tcp   mysql


4、查看无法访问的原因并处理

       前面的步骤几乎都一样,但是我们这里 Nacos 并不能访问,因为我们指定的目录下确少配置文件。查看错误的方式通过 docker logs 命令来查看。

[root@localhost ~]# docker logs 6f+exportCUSTOM_SEARCH_NAMES=application,custom
+CUSTOM_SEARCH_NAMES=application,custom
+exportCUSTOM_SEARCH_LOCATIONS=/home/nacos/init.d/,file:/home/nacos/conf/
+CUSTOM_SEARCH_LOCATIONS=/home/nacos/init.d/,file:/home/nacos/conf/
……
Logging system failed to initialize using configuration from '/home/nacos/conf/nacos-logback.xml'java.io.FileNotFoundException: /home/nacos/conf/nacos-logback.xml (No such file or directory)
        at java.io.FileInputStream.open0(Native Method)
        at java.io.FileInputStream.open(FileInputStream.java:195)
        at java.io.FileInputStream.<init>(FileInputStream.java:138)
        at java.io.FileInputStream.<init>(FileInputStream.java:93)
        at sun.net.www.protocol.file.FileURLConnection.connect(FileURLConnection.java:90)
        at sun.net.www.protocol.file.FileURLConnection.getInputStream(FileURLConnection.java:188)
        at java.net.URL.openStream(URL.java:1068)
        at org.springframework.boot.context.logging.LoggingApplicationListener.initializeSystem(LoggingApplicationListener.java:293)
        at org.springframework.boot.context.logging.LoggingApplicationListener.initialize(LoggingApplicationListener.java:264)
        at org.springframework.boot.context.logging.LoggingApplicationListener.onApplicationEnvironmentPreparedEvent(LoggingApplicationListener.java:226)
        at org.springframework.boot.context.logging.LoggingApplicationListener.onApplicationEvent(LoggingApplicationListener.java:203)
        at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:172)
        at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:165)
        at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:139)
……
15:26:43.963 [main] DEBUG org.springframework.boot.context.logging.ClasspathLoggingApplicationListener - Application failed to start with classpath: [jar:file:/home/nacos/target/nacos-server.jar!/BOOT-INF/classes!/, jar:file:/home/nacos/target/nacos-server.jar!/BOOT-INF/lib/nacos-config-2.0.3.jar!/, jar:file:/home/nacos/target/nacos-server.jar!/BOOT-INF/lib/spring-boot-starter-web-2.1.17.RELEASE.jar!/, jar:file:/home/nacos/target/nacos-server.jar!/BOOT-INF/lib/spring-boot-starter-json-2.1.17.RELEASE.jar!/, jar:file:/home/nacos/target/nacos-server.jar!/BOOT-INF/lib/jackson-datatype-jdk8-2.9.10.jar!/, jar:file:/home/nacos/target/nacos-server.jar!/BOOT-INF/lib/jackson-datatype-jsr310-2.9.10.jar!/, jar:file:/home/nacos/target/nacos-server.jar!/BOOT-INF/lib/jackson-module-parameter-names-2.9.10.jar!/, jar:file:/home/nacos/target/nacos-server.jar!/BOOT-INF/lib/hibernate-validator-6.0.20.Final.jar!/, jar:file:/home/nacos/target/nacos-server.jar!/BOOT-INF/lib/validation-api-2.0.1.Final.jar!/, jar:file:/home/nacos/target/nacos-server.jar!/BOOT-INF/lib/jboss-logging-3.3.3.Final.jar!/, jar:file:/home/nacos/target/nacos-server.jar!/BOOT-INF/lib/classmate-1.4.0.jar!/, jar:file:/home/nacos/target/nacos-server.jar!/BOOT-INF/lib/spring-web-5.1.18.RELEASE.jar!/, jar:file:/home/nacos/target/nacos-server.jar!/BOOT-INF/lib/spring-webmvc-5.1.18.RELEASE.jar!/, jar:file:/home/nacos/target/nacos-server.jar!/BOOT-INF/lib/nacos-api-2.0.3.jar!/, jar:file:/home/nacos/target/nacos-server.jar!/BOOT-INF/lib/reflections-0.9.11.jar!/, jar:file:/home/nacos/target/nacos-server.jar!/BOOT-INF/lib/javassist-3.21.0-GA.jar!/, jar:file:/home/nacos/target/nacos-server.jar!/BOOT-INF/lib/javax.annotation-api-1.3.2.jar!/, jar:file:/home/nacos/target/nacos-server.jar!/BOOT-INF/lib/nacos-core-2.0.3.jar!/, jar:file:/home/nacos/target/nacos-server.jar!/BOOT-INF/lib/nacos-common-2.0.3.jar!/, jar:file:/home/nacos/target/nacos-server.jar!/BOOT-INF/lib/nacos-consistency-2.0.3.jar!/, jar:file:/home/nacos/target/nacos-server.jar!/BOOT-INF/lib/hessian-4.0.63.jar!/, jar:file:/home/nacos/target/nacos-server.jar!/BOOT-INF/lib/nacos-auth-2.0.3.jar!/, jar:file:/home/nacos/target/nacos-server.jar!/BOOT-INF/lib/nacos-sys-2.0.3.jar!/, jar:file:/home/nacos/target/nacos-server.jar!/BOOT-INF/lib/jjwt-api-0.11.2.jar!/, jar:file:/home/nacos/target/nacos-server.jar!/BOOT-INF/lib/jjwt-impl-0.11.2.jar!/, jar:file:/home/nacos/target/nacos-server.jar!/BOOT-INF/lib/jjwt-jackson-0.11.2.jar!/, jar:file:/home/nacos/target/nacos-server.jar!/BOOT-INF/lib/spring-test-5.1.18.RELEASE.jar!/, jar:file:/home/nacos/target/nacos-server.jar!/BOOT-INF/lib/spring-boot-test-2.1.17.RELEASE.jar!/, jar:file:/home/nacos/target/nacos-server.jar!/BOOT-INF/lib/jraft-core-1.3.5.jar!/, jar:file:/home/nacos/target/nacos-server.jar!/BOOT-INF/lib/asm-6.0.jar!/, jar:file:/home/nacos/target/nacos-server.jar!/BOOT-INF/lib/rocksdbjni-5.18.4.jar!/, jar:file:/home/nacos/target/nacos-server.jar!/BOOT-INF/lib/jna-4.5.2.jar!/, jar:file:/home/nacos/target/nacos-server.jar!/BOOT-INF/lib/jctools-core-2.1.1.jar!/, jar:file:/home/nacos/target/nacos-server.jar!/BOOT-INF/lib/disruptor-3.3.7.jar!/, jar:file:/home/nacos/target/nacos-server.jar!/BOOT-INF/lib/commons-lang-2.6.jar!/, jar:file:/home/nacos/target/nacos-server.jar!/BOOT-INF/lib/hessian-3.3.6.jar!/, jar:file:/home/nacos/target/nacos-server.jar!/BOOT-INF/lib/metrics-core-4.0.7.jar!/, jar:file:/home/nacos/target/nacos-server.jar!/BOOT-INF/lib/rpc-grpc-impl-1.3.5.jar!/, jar:file:/home/nacos/target/nacos-server.jar!/BOOT-INF/lib/guava-30.1-jre.jar!/, jar:file:/home/nacos/target/nacos-server.jar!/BOOT-INF/lib/failureaccess-1.0.1.jar!/, jar:file:/home/nacos/target/nacos-server.jar!/BOOT-INF/lib/listenablefuture-9999.0-empty-to-avoid-conflict-with-guava.jar!/, jar:file:/home/nacos/target/nacos-server.jar!/BOOT-INF/lib/jsr305-3.0.2.jar!/, jar:file:/home/nacos/target/nacos-server.jar!/BOOT-INF/lib/checker-qual-3.5.0.jar!/, jar:file:/home/nacos/target/nacos-server.jar!/BOOT-INF/lib/j2objc-annotations-1.3.jar!/, jar:file:/home/nacos/target/nacos-server.jar!/BOOT-INF/lib/spring-boot-starter-jdbc-2.1.17.RELEASE.jar!/, jar:file:/home/nacos/target/nacos-server.jar!/BOOT-INF/lib/HikariCP-3.4.2.jar!/, jar:file:/home/nacos/target/nacos-server.jar!/BOOT-INF/lib/spring-jdbc-5.1.18.RELEASE.jar!/, jar:file:/home/nacos/target/nacos-server.jar!/BOOT-INF/lib/spring-tx-5.1.18.RELEASE.jar!/, jar:file:/home/nacos/target/nacos-server.jar!/BOOT-INF/lib/commons-io-2.7.jar!/, jar:file:/home/nacos/target/nacos-server.jar!/BOOT-INF/lib/mysql-connector-java-8.0.21.jar!/, jar:file:/home/nacos/target/nacos-server.jar!/BOOT-INF/lib/derby-10.14.2.0.jar!/, jar:file:/home/nacos/target/nacos-server.jar!/BOOT-INF/lib/logback-classic-1.2.3.jar!/, jar:file:/home/nacos/target/nacos-server.jar!/BOOT-INF/lib/aspectjrt-1.9.6.jar!/, jar:file:/home/nacos/target/nacos-server.jar!/BOOT-INF/lib/cglib-nodep-2.1.jar!/, jar:file:/home/nacos/target/nacos-server.jar!/BOOT-INF/lib/httpasyncclient-4.1.3.jar!/, jar:file:/home/nacos/target/nacos-server.jar!/BOOT-INF/lib/httpcore-nio-4.4.13.jar!/, jar:file:/home/nacos/target/nacos-server.jar!/BOOT-INF/lib/commons-logging-1.2.jar!/, jar:file:/home/nacos/target/nacos-server.jar!/BOOT-INF/lib/spring-boot-starter-tomcat-2.1.17.RELEASE.jar!/, jar:file:/home/nacos/target/nacos-server.jar!/BOOT-INF/lib/tomcat-embed-websocket-9.0.38.jar!/, jar:file:/home/nacos/target/nacos-server.jar!/BOOT-INF/lib/jackson-core-2.12.2.jar!/, jar:file:/home/nacos/target/nacos-server.jar!/BOOT-INF/lib/jackson-databind-2.12.2.jar!/, jar:file:/home/nacos/target/nacos-server.jar!/BOOT-INF/lib/jackson-annotations-2.12.2.jar!/, jar:file:/home/nacos/target/nacos-server.jar!/BOOT-INF/lib/micrometer-registry-prometheus-1.1.18.jar!/, jar:file:/home/nacos/target/nacos-server.jar!/BOOT-INF/lib/micrometer-core-1.1.18.jar!/, jar:file:/home/nacos/target/nacos-server.jar!/BOOT-INF/lib/HdrHistogram-2.1.9.jar!/, jar:file:/home/nacos/target/nacos-server.jar!/BOOT-INF/lib/LatencyUtils-2.0.3.jar!/, jar:file:/home/nacos/target/nacos-server.jar!/BOOT-INF/lib/simpleclient_common-0.5.0.jar!/, jar:file:/home/nacos/target/nacos-server.jar!/BOOT-INF/lib/micrometer-registry-influx-1.1.18.jar!/, jar:file:/home/nacos/target/nacos-server.jar!/BOOT-INF/lib/micrometer-registry-elastic-1.1.18.jar!/, jar:file:/home/nacos/target/nacos-server.jar!/BOOT-INF/lib/spring-boot-starter-aop-2.1.17.RELEASE.jar!/, jar:file:/home/nacos/target/nacos-server.jar!/BOOT-INF/lib/aspectjweaver-1.9.6.jar!/, jar:file:/home/nacos/target/nacos-server.jar!/BOOT-INF/lib/spring-boot-starter-actuator-2.1.17.RELEASE.jar!/, jar:file:/home/nacos/target/nacos-server.jar!/BOOT-INF/lib/spring-boot-actuator-autoconfigure-2.1.17.RELEASE.jar!/, jar:file:/home/nacos/target/nacos-server.jar!/BOOT-INF/lib/spring-boot-actuator-2.1.17.RELEASE.jar!/, jar:file:/home/nacos/target/nacos-server.jar!/BOOT-INF/lib/snakeyaml-1.23.jar!/, jar:file:/home/nacos/target/nacos-server.jar!/BOOT-INF/lib/tomcat-embed-jasper-9.0.40.jar!/, jar:file:/home/nacos/target/nacos-server.jar!/BOOT-INF/lib/tomcat-embed-core-9.0.38.jar!/, jar:file:/home/nacos/target/nacos-server.jar!/BOOT-INF/lib/tomcat-annotations-api-9.0.38.jar!/, jar:file:/home/nacos/target/nacos-server.jar!/BOOT-INF/lib/tomcat-embed-el-9.0.38.jar!/, jar:file:/home/nacos/target/nacos-server.jar!/BOOT-INF/lib/ecj-3.18.0.jar!/, jar:file:/home/nacos/target/nacos-server.jar!/BOOT-INF/lib/nacos-naming-2.0.3.jar!/, jar:file:/home/nacos/target/nacos-server.jar!/BOOT-INF/lib/netty-all-4.1.59.Final.jar!/, jar:file:/home/nacos/target/nacos-server.jar!/BOOT-INF/lib/spring-boot-2.1.17.RELEASE.jar!/, jar:file:/home/nacos/target/nacos-server.jar!/BOOT-INF/lib/spring-core-5.1.18.RELEASE.jar!/, jar:file:/home/nacos/target/nacos-server.jar!/BOOT-INF/lib/spring-jcl-5.1.18.RELEASE.jar!/, jar:file:/home/nacos/target/nacos-server.jar!/BOOT-INF/lib/spring-context-5.1.18.RELEASE.jar!/, jar:file:/home/nacos/target/nacos-server.jar!/BOOT-INF/lib/commons-collections-3.2.2.jar!/, jar:file:/home/nacos/target/nacos-server.jar!/BOOT-INF/lib/jackson-core-asl-1.9.13.jar!/, jar:file:/home/nacos/target/nacos-server.jar!/BOOT-INF/lib/slf4j-api-1.7.7.jar!/, jar:file:/home/nacos/target/nacos-server.jar!/BOOT-INF/lib/logback-core-1.2.3.jar!/, jar:file:/home/nacos/target/nacos-server.jar!/BOOT-INF/lib/mina-core-2.0.0-RC1.jar!/, jar:file:/home/nacos/target/nacos-server.jar!/BOOT-INF/lib/javatuples-1.2.jar!/, jar:file:/home/nacos/target/nacos-server.jar!/BOOT-INF/lib/httpcore-4.4.13.jar!/, jar:file:/home/nacos/target/nacos-server.jar!/BOOT-INF/lib/httpclient-4.5.12.jar!/, jar:file:/home/nacos/target/nacos-server.jar!/BOOT-INF/lib/commons-codec-1.11.jar!/, jar:file:/home/nacos/target/nacos-server.jar!/BOOT-INF/lib/nacos-cmdb-2.0.3.jar!/, jar:file:/home/nacos/target/nacos-server.jar!/BOOT-INF/lib/nacos-istio-2.0.3.jar!/, jar:file:/home/nacos/target/nacos-server.jar!/BOOT-INF/lib/nacos-client-2.0.3.jar!/, jar:file:/home/nacos/target/nacos-server.jar!/BOOT-INF/lib/simpleclient-0.5.0.jar!/, jar:file:/home/nacos/target/nacos-server.jar!/BOOT-INF/lib/grpc-netty-shaded-1.24.0.jar!/, jar:file:/home/nacos/target/nacos-server.jar!/BOOT-INF/lib/grpc-core-1.24.0.jar!/, jar:file:/home/nacos/target/nacos-server.jar!/BOOT-INF/lib/gson-2.8.6.jar!/, jar:file:/home/nacos/target/nacos-server.jar!/BOOT-INF/lib/annotations-4.1.1.4.jar!/, jar:file:/home/nacos/target/nacos-server.jar!/BOOT-INF/lib/perfmark-api-0.17.0.jar!/, jar:file:/home/nacos/target/nacos-server.jar!/BOOT-INF/lib/opencensus-api-0.21.0.jar!/, jar:file:/home/nacos/target/nacos-server.jar!/BOOT-INF/lib/opencensus-contrib-grpc-metrics-0.21.0.jar!/, jar:file:/home/nacos/target/nacos-server.jar!/BOOT-INF/lib/grpc-protobuf-1.24.0.jar!/, jar:file:/home/nacos/target/nacos-server.jar!/BOOT-INF/lib/grpc-api-1.24.0.jar!/, jar:file:/home/nacos/target/nacos-server.jar!/BOOT-INF/lib/grpc-context-1.24.0.jar!/, jar:file:/home/nacos/target/nacos-server.jar!/BOOT-INF/lib/error_prone_annotations-2.3.2.jar!/, jar:file:/home/nacos/target/nacos-server.jar!/BOOT-INF/lib/animal-sniffer-annotations-1.17.jar!/, jar:file:/home/nacos/target/nacos-server.jar!/BOOT-INF/lib/grpc-protobuf-lite-1.24.0.jar!/, jar:file:/home/nacos/target/nacos-server.jar!/BOOT-INF/lib/grpc-stub-1.24.0.jar!/, jar:file:/home/nacos/target/nacos-server.jar!/BOOT-INF/lib/proto-google-common-protos-1.17.0.jar!/, jar:file:/home/nacos/target/nacos-server.jar!/BOOT-INF/lib/protobuf-java-3.8.0.jar!/, jar:file:/home/nacos/target/nacos-server.jar!/BOOT-INF/lib/api-0.1.27.jar!/, jar:file:/home/nacos/target/nacos-server.jar!/BOOT-INF/lib/log4j-over-slf4j-1.7.30.jar!/, jar:file:/home/nacos/target/nacos-server.jar!/BOOT-INF/lib/jcl-over-slf4j-1.7.30.jar!/, jar:file:/home/nacos/target/nacos-server.jar!/BOOT-INF/lib/jul-to-slf4j-1.7.30.jar!/, jar:file:/home/nacos/target/nacos-server.jar!/BOOT-INF/lib/spring-boot-starter-security-2.1.17.RELEASE.jar!/, jar:file:/home/nacos/target/nacos-server.jar!/BOOT-INF/lib/spring-boot-starter-2.1.17.RELEASE.jar!/, jar:file:/home/nacos/target/nacos-server.jar!/BOOT-INF/lib/spring-boot-autoconfigure-2.1.17.RELEASE.jar!/, jar:file:/home/nacos/target/nacos-server.jar!/BOOT-INF/lib/spring-boot-starter-logging-2.1.17.RELEASE.jar!/, jar:file:/home/nacos/target/nacos-server.jar!/BOOT-INF/lib/log4j-to-slf4j-2.11.2.jar!/, jar:file:/home/nacos/target/nacos-server.jar!/BOOT-INF/lib/log4j-api-2.13.3.jar!/, jar:file:/home/nacos/target/nacos-server.jar!/BOOT-INF/lib/spring-aop-5.1.18.RELEASE.jar!/, jar:file:/home/nacos/target/nacos-server.jar!/BOOT-INF/lib/spring-beans-5.1.18.RELEASE.jar!/, jar:file:/home/nacos/target/nacos-server.jar!/BOOT-INF/lib/spring-security-config-5.1.12.RELEASE.jar!/, jar:file:/home/nacos/target/nacos-server.jar!/BOOT-INF/lib/spring-security-core-5.1.12.RELEASE.jar!/, jar:file:/home/nacos/target/nacos-server.jar!/BOOT-INF/lib/spring-security-web-5.1.12.RELEASE.jar!/, jar:file:/home/nacos/target/nacos-server.jar!/BOOT-INF/lib/spring-expression-5.1.18.RELEASE.jar!/, jar:file:/home/nacos/target/nacos-server.jar!/BOOT-INF/lib/spring-boot-jarmode-layertools-2.5.3.jar!/]
15:26:45.524 [background-preinit] DEBUG org.hibernate.validator.messageinterpolation.ResourceBundleMessageInterpolator - Loaded expression factory via original TCCL
15:26:45.773 [background-preinit] DEBUG org.hibernate.validator.internal.engine.ValidatorFactoryImpl - HV000234: Using org.hibernate.validator.messageinterpolation.ResourceBundleMessageInterpolator as ValidatorFactory-scoped message interpolator.
15:26:45.778 [background-preinit] DEBUG org.hibernate.validator.internal.engine.ValidatorFactoryImpl - HV000234: Using org.hibernate.validator.internal.engine.resolver.TraverseAllTraversableResolver as ValidatorFactory-scoped traversable resolver.
15:26:45.778 [background-preinit] DEBUG org.hibernate.validator.internal.engine.ValidatorFactoryImpl - HV000234: Using org.hibernate.validator.internal.util.ExecutableParameterNameProvider as ValidatorFactory-scoped parameter name provider.
15:26:45.780 [background-preinit] DEBUG org.hibernate.validator.internal.engine.ValidatorFactoryImpl - HV000234: Using org.hibernate.validator.internal.engine.DefaultClockProvider as ValidatorFactory-scoped clock provider.
15:26:45.781 [background-preinit] DEBUG org.hibernate.validator.internal.engine.ValidatorFactoryImpl - HV000234: Using org.hibernate.validator.internal.engine.scripting.DefaultScriptEvaluatorFactory as ValidatorFactory-scoped script evaluator factory.
15:27:37.181 [main] ERROR org.springframework.boot.SpringApplication - Application run failed
java.lang.IllegalStateException: java.io.FileNotFoundException: /home/nacos/conf/nacos-logback.xml (No such file or directory)

       从上面的日志信息中可以看出,确少配置文件。查看下面目录中的内容。

[root@localhost ~]# cd /mydata/nacos/conf[root@localhost conf]# ls

       最简单的方式是从本地上传一份对应版本的配置文件到该目录下,然后重启容器。

docker restart nacos

       这样,Nacos 就可以启动了。


注:如果机器配置低的话,Nacos 的启动会比较慢,多用 docker logs 进行查看,以确保 Nacos 真的启动了再进行使用。



相关文章
|
2月前
|
Java Nacos 数据库
使用 nacos 搭建注册中心及配置中心
使用 nacos 搭建注册中心及配置中心
68 5
|
2月前
|
NoSQL Java Nacos
SpringCloud集成Seata并使用Nacos做注册中心与配置中心
SpringCloud集成Seata并使用Nacos做注册中心与配置中心
73 3
|
6天前
|
负载均衡 Java Nacos
SpringCloud基础1——远程调用、Eureka,Nacos注册中心、Ribbon负载均衡
微服务介绍、SpringCloud、服务拆分和远程调用、Eureka注册中心、Ribbon负载均衡、Nacos注册中心
SpringCloud基础1——远程调用、Eureka,Nacos注册中心、Ribbon负载均衡
|
1月前
|
Cloud Native Java Nacos
微服务注册中心-Nacos概述
该博客文章提供了对Nacos的全面概述,包括其基本介绍、与Spring Cloud集成的优势、主要功能以及如何在Spring Cloud Alibaba项目中作为服务注册中心使用Nacos。文章解释了Nacos是一个动态服务发现、配置管理和服务管理平台,支持服务发现、健康监测、动态配置、DNS服务和元数据管理。还介绍了如何下载和启动Nacos服务器,以及如何将微服务注册到Nacos中,包括修改pom.xml文件引入依赖、配置application.properties文件和使用@EnableDiscoveryClient注解开启服务注册发现功能。
微服务注册中心-Nacos概述
|
26天前
|
存储 持续交付 数据安全/隐私保护
Docker 注册中心
【8月更文挑战第24天】
12 0
|
2月前
|
Nacos 微服务
Zookeeper 的 ZAB 协议 以及 zookeeper 与 nacos 注册中心比对
Zookeeper 的 ZAB 协议 以及 zookeeper 与 nacos 注册中心比对
40 4
|
1月前
|
Java Nacos Docker
"揭秘!Docker部署Seata遇上Nacos,注册成功却报错?这些坑你不得不防!一网打尽解决秘籍,让你的分布式事务稳如老狗!"
【8月更文挑战第15天】在微服务架构中,Nacos搭配Seata确保数据一致性时,Docker部署Seata后可能出现客户端连接错误,如“can not connect to services-server”。此问题多由网络配置不当、配置文件错误或版本不兼容引起。解决策略包括:调整Docker网络设置确保可达性;检查并修正`file.conf`和`registry.conf`中的Nacos地址和端口;验证Seata与Nacos版本兼容性;修改配置后重启服务;参考官方文档和最佳实践进行配置。通过这些步骤,能有效排除故障,保障服务稳定运行。
36 0
|
1月前
|
Kubernetes Nacos 微服务
【技术难题破解】Nacos v2.2.3 + K8s 微服务注册:强制删除 Pod 却不消失?!7步排查法+实战代码,手把手教你解决Nacos Pod僵死问题,让服务瞬间满血复活!
【8月更文挑战第15天】Nacos作为微服务注册与配置中心受到欢迎,但有时会遇到“v2.2.3 k8s 微服务注册nacos强制删除 pod不消失”的问题。本文介绍此现象及其解决方法,帮助开发者确保服务稳定运行。首先需检查Pod状态与事件、配置文件及Nacos配置,确认无误后可调整Pod生命周期管理,并检查Kubernetes版本兼容性。若问题持续,考虑使用Finalizers、审查Nacos日志或借助Kubernetes诊断工具。必要时,可尝试手动强制删除Pod。通过系统排查,通常能有效解决此问题。
42 0
|
1月前
|
安全 Nacos 数据库
【技术安全大揭秘】Nacos暴露公网后被非法访问?!6大安全加固秘籍,手把手教你如何保护数据库免遭恶意篡改,打造坚不可摧的微服务注册与配置中心!从限制公网访问到启用访问控制,全方位解析如何构建安全防护体系,让您从此告别数据安全风险!
【8月更文挑战第15天】Nacos是一款广受好评的微服务注册与配置中心,但其公网暴露可能引发数据库被非法访问甚至篡改的安全隐患。本文剖析此问题并提供解决方案,包括限制公网访问、启用HTTPS、加强数据库安全、配置访问控制及监控等,帮助开发者确保服务安全稳定运行。
79 0
|
1月前
|
安全 Nacos 数据安全/隐私保护
【技术干货】破解Nacos安全隐患:连接用户名与密码明文传输!掌握HTTPS、JWT与OAuth2.0加密秘籍,打造坚不可摧的微服务注册与配置中心!从原理到实践,全方位解析如何构建安全防护体系,让您从此告别数据泄露风险!
【8月更文挑战第15天】Nacos是一款广受好评的微服务注册与配置中心,但其连接用户名和密码的明文传输成为安全隐患。本文探讨加密策略提升安全性。首先介绍明文传输风险,随后对比三种加密方案:HTTPS简化数据保护;JWT令牌减少凭证传输,适配分布式环境;OAuth2.0增强安全,支持多授权模式。每种方案各有千秋,开发者需根据具体需求选择最佳实践,确保服务安全稳定运行。
77 0