我用的 nacos 2.0.3 集群启动,最后启动的那个会把前两个给挤下去

来源:4-4 【查缺补漏】Nacos 的配置与安装

惜福7840346

2021-08-25

如题,是不是因为内存不够的原因?
端口号,8848,8858,8868
内存 3G

  1. 8848 启动后端口变化
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 0.0.0.0:8848            0.0.0.0:*               LISTEN      16602/java
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      930/sshd
tcp        0      0 0.0.0.0:9848            0.0.0.0:*               LISTEN      16602/java
tcp        0      0 0.0.0.0:9849            0.0.0.0:*               LISTEN      16602/java
tcp        0      0 0.0.0.0:1433            0.0.0.0:*               LISTEN      29603/sqlservr
tcp        0      0 127.0.0.1:1434          0.0.0.0:*               LISTEN      29603/sqlservr
tcp        0      0 0.0.0.0:7848            0.0.0.0:*               LISTEN      16602/java
tcp        0      0 0.0.0.0:27017           0.0.0.0:*               LISTEN      4793/mongod
tcp6       0      0 :::22                   :::*                    LISTEN      930/sshd
tcp6       0      0 :::1433                 :::*                    LISTEN      29603/sqlservr
tcp6       0      0 :::33060                :::*                    LISTEN      1458/mysqld
tcp6       0      0 :::3306                 :::*                    LISTEN      1458/mysqld
  1. 8858 启动后端口变化
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 0.0.0.0:7858            0.0.0.0:*               LISTEN      16979/java
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      930/sshd
tcp        0      0 0.0.0.0:1433            0.0.0.0:*               LISTEN      29603/sqlservr
tcp        0      0 0.0.0.0:8858            0.0.0.0:*               LISTEN      16979/java
tcp        0      0 127.0.0.1:1434          0.0.0.0:*               LISTEN      29603/sqlservr
tcp        0      0 0.0.0.0:9858            0.0.0.0:*               LISTEN      16979/java
tcp        0      0 0.0.0.0:9859            0.0.0.0:*               LISTEN      16979/java
tcp        0      0 0.0.0.0:27017           0.0.0.0:*               LISTEN      4793/mongod
tcp6       0      0 :::22                   :::*                    LISTEN      930/sshd
tcp6       0      0 :::1433                 :::*                    LISTEN      29603/sqlservr
tcp6       0      0 :::33060                :::*                    LISTEN      1458/mysqld
tcp6       0      0 :::3306                 :::*                    LISTEN      1458/mysqld
  1. 8868 启动后端口变化
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      930/sshd
tcp        0      0 0.0.0.0:1433            0.0.0.0:*               LISTEN      29603/sqlservr
tcp        0      0 127.0.0.1:1434          0.0.0.0:*               LISTEN      29603/sqlservr
tcp        0      0 0.0.0.0:7868            0.0.0.0:*               LISTEN      17457/java
tcp        0      0 0.0.0.0:8868            0.0.0.0:*               LISTEN      17457/java
tcp        0      0 0.0.0.0:27017           0.0.0.0:*               LISTEN      4793/mongod
tcp        0      0 0.0.0.0:9868            0.0.0.0:*               LISTEN      17457/java
tcp        0      0 0.0.0.0:9869            0.0.0.0:*               LISTEN      17457/java
tcp6       0      0 :::22                   :::*                    LISTEN      930/sshd
tcp6       0      0 :::1433                 :::*                    LISTEN      29603/sqlservr
tcp6       0      0 :::33060                :::*                    LISTEN      1458/mysqld
tcp6       0      0 :::3306                 :::*                    LISTEN      1458/mysqld
  1. 日志没有错误
2021-08-25 15:57:39,562 INFO Reflections took 74 ms to scan 2 urls, producing 2 keys and 8 values

2021-08-25 15:57:39,568 INFO Reflections took 3 ms to scan 1 urls, producing 1 keys and 1 values

2021-08-25 15:57:40,486 INFO Nacos is starting...

2021-08-25 15:57:40,770 INFO Initializing ExecutorService 'applicationTaskExecutor'

2021-08-25 15:57:41,046 INFO Adding welcome page: class path resource [static/index.html]

2021-08-25 15:57:41,495 INFO Nacos is starting...

2021-08-25 15:57:41,742 INFO Creating filter chain: Ant [pattern='/**'], []

2021-08-25 15:57:41,791 INFO Creating filter chain: any request, [org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter@1dd7796b, org.springframework.security.web.context.SecurityContextPersistenceFilter@710d89e2, org.springframework.security.web.header.HeaderWriterFilter@75361cf6, org.springframework.security.web.csrf.CsrfFilter@6a9b9909, org.springframework.security.web.authentication.logout.LogoutFilter@79d9214d, org.springframework.security.web.savedrequest.RequestCacheAwareFilter@4fc142ec, org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter@1b9776f5, org.springframework.security.web.authentication.AnonymousAuthenticationFilter@67a3bd51, org.springframework.security.web.session.SessionManagementFilter@6ba7383d, org.springframework.security.web.access.ExceptionTranslationFilter@a518813]

2021-08-25 15:57:41,947 INFO Initializing ExecutorService 'taskScheduler'

2021-08-25 15:57:41,985 INFO Exposing 16 endpoint(s) beneath base path '/actuator'

2021-08-25 15:57:42,151 INFO Starting ProtocolHandler ["http-nio-8868"]

2021-08-25 15:57:42,186 INFO Tomcat started on port(s): 8868 (http) with context path '/nacos'

2021-08-25 15:57:42,197 INFO Started Nacos in 33.854 seconds (JVM running for 35.501)

2021-08-25 15:57:42,197 INFO Nacos started successfully in cluster mode. use external storage

2021-08-25 15:57:43,748 INFO Initializing Spring DispatcherServlet 'dispatcherServlet'

2021-08-25 15:57:43,748 INFO Initializing Servlet 'dispatcherServlet'

2021-08-25 15:57:43,763 INFO Completed initialization in 14 ms

写回答

1回答

惜福7840346

提问者

2021-08-25

真的是内存不够的原因

修改 startup.sh 文件,把内存该小就行了

修改前

JAVA_OPT="${JAVA_OPT} -server -Xms2g -Xmx2g -Xmn1g -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=320m"

修改后

JAVA_OPT="${JAVA_OPT} -server -Xms512m -Xmx512m -Xmn256m -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=320m"


端口情况:

Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name

tcp        0      0 0.0.0.0:8848            0.0.0.0:*               LISTEN      18201/java

tcp        0      0 0.0.0.0:7858            0.0.0.0:*               LISTEN      18165/java

tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      930/sshd

tcp        0      0 0.0.0.0:9848            0.0.0.0:*               LISTEN      18201/java

tcp        0      0 0.0.0.0:9849            0.0.0.0:*               LISTEN      18201/java

tcp        0      0 0.0.0.0:8858            0.0.0.0:*               LISTEN      18165/java

tcp        0      0 0.0.0.0:7868            0.0.0.0:*               LISTEN      18116/java

tcp        0      0 0.0.0.0:9858            0.0.0.0:*               LISTEN      18165/java

tcp        0      0 0.0.0.0:9859            0.0.0.0:*               LISTEN      18165/java

tcp        0      0 0.0.0.0:8868            0.0.0.0:*               LISTEN      18116/java

tcp        0      0 0.0.0.0:7848            0.0.0.0:*               LISTEN      18201/java

tcp        0      0 0.0.0.0:27017           0.0.0.0:*               LISTEN      4793/mongod

tcp        0      0 0.0.0.0:9868            0.0.0.0:*               LISTEN      18116/java

tcp        0      0 0.0.0.0:9869            0.0.0.0:*               LISTEN      18116/java

tcp6       0      0 :::22                   :::*                    LISTEN      930/sshd

tcp6       0      0 :::33060                :::*                    LISTEN      1458/mysqld

tcp6       0      0 :::3306                 :::*                    LISTEN      1458/mysqld


1
0

Spring Cloud / Alibaba 微服务架构实战

从架构设计到开发实践,手把手实现

1218 学习 · 674 问题

查看课程