{"id":258222,"date":"2022-12-19T09:09:33","date_gmt":"2022-12-19T01:09:33","guid":{"rendered":"https:\/\/gulass.cn\/?p=258222"},"modified":"2022-11-29T10:11:51","modified_gmt":"2022-11-29T02:11:51","slug":"nacos-easy-linux","status":"publish","type":"post","link":"https:\/\/gulass.cn\/nacos-easy-linux.html","title":{"rendered":"\u7b80\u5355\u4ecb\u7ecdnacos\u5355\u673a\u672c\u5730\u914d\u7f6e\u6587\u4ef6\u5b58\u50a8\u4f4d\u7f6e\u65b9\u5f0f"},"content":{"rendered":"\n\n\n
\u5bfc\u8bfb<\/td>\n\u8fd9\u7bc7\u6587\u7ae0\u4e3b\u8981\u4ecb\u7ecd\u4e86nacos\u5355\u673a\u672c\u5730\u914d\u7f6e\u6587\u4ef6\u5b58\u50a8\u4f4d\u7f6e\u65b9\u5f0f\uff0c\u5177\u6709\u5f88\u597d\u7684\u53c2\u8003\u4ef7\u503c\uff0c\u5e0c\u671b\u5bf9\u5927\u5bb6\u6709\u6240\u5e2e\u52a9\u3002\u5982\u6709\u9519\u8bef\u6216\u672a\u8003\u8651\u5b8c\u5168\u7684\u5730\u65b9\uff0c\u671b\u4e0d\u541d\u8d50\u6559<\/strong><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n
nacos\u5355\u673a\u672c\u5730\u914d\u7f6e\u6587\u4ef6\u5b58\u50a8\u4f4d\u7f6e<\/strong><\/div>\n

C:\\Users***\\nacos\\config\\config_rpc_client_nacos\\<\/p>\n

\"\"<\/p>\n

\u5355\u673a\u7248Nacos\u6587\u4ef6\u914d\u7f6e\u95ee\u9898<\/strong><\/div>\n
Nacos\u670d\u52a1\u81ea\u52a8\u5173\u95ed<\/strong><\/span><\/div>\n

\u5728\u4f7f\u7528Nacos\u65f6\uff0c\u6709\u65f6\u5019\u4f1a\u9047\u5230\u670d\u52a1\u81ea\u52a8\u5173\u95ed\u7684\u60c5\u51b5\u3002<\/p>\n

\u8fd9\u901a\u5e38\u6d89\u53ca\u5230\u4e09\u65b9\u9762\u7684\u539f\u56e0\uff1a<\/p>\n

  • \u5185\u5b58\u914d\u7f6e<\/li>\n
  • \u542f\u52a8\u65b9\u5f0f<\/li>\n
  • \u5173\u95ed\u65b9\u5f0f<\/li>\n

    \u4e0b\u9762\u9010\u4e00\u8bf4\u660e\u3002<\/p>\n

    \u5185\u5b58\u914d\u7f6e\u5bfc\u81f4Nacos\u5173\u95ed<\/strong><\/span><\/div>\n

    Nacos\u6700\u65b0\u7248\u672c\u9ed8\u8ba4\u7684JVM\u914d\u7f6e\u662f2G\uff0c\u5982\u679c\u4f60\u7684\u670d\u52a1\u5668\u914d\u7f6e\u6bd4\u8f83\u4f4e\uff0c\u5728\u8fd9\u6837\u7684\u9ed8\u8ba4\u914d\u7f6e\u4e0b\u4f1a\u5bfc\u81f4OOM\u60c5\u51b5\u7684\u53d1\u751f\u3002<\/p>\n

    startup.sh\u4e2d\u914d\u7f6e\u9879\uff1a<\/p>\n

    if [[ \"${MODE}\" == \"standalone\" ]]; then\r\n    JAVA_OPT=\"${JAVA_OPT} -Xms512m -Xmx512m -Xmn256m\"\r\n    JAVA_OPT=\"${JAVA_OPT} -Dnacos.standalone=true\"\r\nelse\r\n    if [[ \"${EMBEDDED_STORAGE}\" == \"embedded\" ]]; then\r\n        JAVA_OPT=\"${JAVA_OPT} -DembeddedStorage=true\"\r\n    fi\r\n    JAVA_OPT=\"${JAVA_OPT} -server -Xms2g -Xmx2g -Xmn1g -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=320m\"\r\n    JAVA_OPT=\"${JAVA_OPT} -XX:-OmitStackTraceInFastThrow -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=${BASE_DIR}\/logs\/java_heapdump.hprof\"\r\n    JAVA_OPT=\"${JAVA_OPT} -XX:-UseLargePages\"\r\n \r\nfi<\/pre>\n

    \u8fd9\u79cd\u60c5\u51b5\uff0c\u8981\u4e48\u5347\u7ea7\u670d\u52a1\u5668\u914d\u7f6e\uff0c\u8981\u4e48\u8c03\u6574JVM\u53c2\u6570\uff0c\u5982\u679c\u975e\u5fc5\u987b\u5efa\u8bae\u8c03\u6574JVM\u53c2\u6570\u3002\u9664\u975e\u4e1a\u52a1\u91cf\u5fc5\u987b\u9700\u8981\u8fd9\u4e48\u5927\u7684\u914d\u7f6e\u3002<\/p>\n

    \u542f\u52a8\u65b9\u5f0f\u5bfc\u81f4\u5173\u95ed<\/strong><\/span><\/div>\n

    \u4f7f\u7528Nacos\u8f83\u4f4e\u7248\u672c\u65f6\uff0c\u6bd4\u5982nacos 0.7.0 releases\u53ca\u4ee5\u4e0b\u7248\u672c\u65f6\uff0cLinux\u4e0b\u5982\u4e0b\u65b9\u5f0f\u542f\u52a8\uff1a<\/p>\n

    sh startup.sh -m standalone<\/pre>\n

    \u90a3\u4e48\uff0c\u5f53\u5173\u95ed\u7a97\u53e3\u4e4b\u540e\uff0cNacos\u670d\u52a1\u4f1a\u81ea\u52a8\u9000\u51fa\u3002\u8fd9\u662f\u56e0\u4e3a\u6ca1\u6709\u4f5c\u4e3a\u540e\u53f0\u8fdb\u7a0b\u542f\u52a8\u7684\u539f\u56e0\u3002<\/p>\n

    \u89e3\u51b3\u65b9\u6848\uff0c\u542f\u52a8\u65f6\u4f5c\u4e3a\u540e\u53f0\u8fdb\u7a0b\u8fdb\u884c\u542f\u52a8\uff1a<\/p>\n

    sh startup.sh -m standalone &\r\n \r\n\/\/ \u6216\r\n \r\nsetsid sh startup.sh -m standalone &\r\n\u5728\u9ad8\u7248\u672c\u4e2d\uff0c\u6b64\u95ee\u9898\u5df2\u7ecf\u5f97\u5230\u89e3\u51b3\uff0c\u811a\u672c\u4e2d\u6267\u884cJava\u7a0b\u5e8f\u65f6\uff0c\u7528\u7684\u4fbf\u662f\u540e\u53f0\u8fdb\u7a0b\u3002<\/pre>\n
    shutdown\u811a\u672c\u8bef\u6740<\/strong><\/span><\/div>\n

    \u5728\u8f83\u4f4e\u7248\u672c\u65f6\uff0c\u9ed8\u8ba4\u7684shutdown.sh\u811a\u672c\u811a\u672c\u5728\u96c6\u7fa4\u60c5\u51b5\u4e0b\u6267\u884c\u4f1a\u5c06\u540c\u4e00\u53f0\u673a\u5b50\u4e0a\u7684\u6240\u6709\u8282\u70b9\u90fd\u5173\u95ed\u6389\uff0c\u56e0\u4e3ashell\u547d\u4ee4\u67e5\u627e\u7684\u662f\u6709nacos.nacos\u6807\u8bb0\u7684pid\uff0c\u5f53\u642d\u5efa\u4f2a\u96c6\u7fa4\u7684\u60c5\u51b5\uff0c\u5c31\u4f1a\u53d1\u751f\u88ab\u8bef\u6740\u7684\u60c5\u51b5\u3002<\/p>\n

    \u4e3a\u4e86\u907f\u514dshutdown.sh\u811a\u672c\u7684\u8bef\u6740\uff0c\u5e94\u8be5\u9ed8\u8ba4\u5173\u95ed\u5f53\u524d\u76ee\u5f55\u4e0b\u7684\u8282\u70b9\u66f4\u4e3a\u5b89\u5168\uff0c\u4f8b\u5982\u5c06\u539f\u811a\u672c\u66f4\u6539\u4e3a\uff1a<\/p>\n

    #!\/bin\/sh\r\n \r\n# Copyright 1999-2018 Alibaba Group Holding Ltd.\r\n# Licensed under the Apache License, Version 2.0 (the \"License\");\r\n# you may not use this file except in compliance with the License.\r\n# You may obtain a copy of the License at\r\n \r\n#      http:\/\/www.apache.org\/licenses\/LICENSE-2.0\r\n#\r\n# Unless required by applicable law or agreed to in writing, software\r\n# distributed under the License is distributed on an \"AS IS\" BASIS,\r\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n# See the License for the specific language governing permissions and\r\n# limitations under the License.\r\nBIN_DIR=$(cd `dirname $0`;pwd)\r\n#\u83b7\u53d6\u9879\u76ee\u6839\u76ee\u5f55\r\nDEPLOY_DIR=$(cd ${BIN_DIR};cd ..;pwd)\r\n \r\npid=`ps ax | grep -i $DEPLOY_DIR |grep java | grep -v grep | awk '{print $1}'`\r\nif [ -z \"$pid\" ] ; then\r\n        echo \"No nacosServer running.\"\r\n        exit -1;\r\nfi\r\n \r\necho \"The nacosServer(${pid}) is running...\"\r\n \r\nkill ${pid}\r\n \r\necho \"Send shutdown request to nacosServer(${pid}) OK\"<\/pre>\n

    \u4ee5\u4e0a\u4e3a\u4e2a\u4eba\u7ecf\u9a8c\uff0c\u5e0c\u671b\u80fd\u7ed9\u5927\u5bb6\u4e00\u4e2a\u53c2\u8003<\/p>\n","protected":false},"excerpt":{"rendered":"

    C:\\Users***\\nacos\\config\\config_rpc_client_nacos\\ \u5728\u4f7f\u7528Na […]<\/p>\n","protected":false},"author":362,"featured_media":257948,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[55],"tags":[],"class_list":["post-258222","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-thread"],"acf":[],"_links":{"self":[{"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/posts\/258222","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/users\/362"}],"replies":[{"embeddable":true,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/comments?post=258222"}],"version-history":[{"count":2,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/posts\/258222\/revisions"}],"predecessor-version":[{"id":258225,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/posts\/258222\/revisions\/258225"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/media\/257948"}],"wp:attachment":[{"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/media?parent=258222"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/categories?post=258222"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/tags?post=258222"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}