{"id":1464,"date":"2023-03-24T22:09:51","date_gmt":"2023-03-24T14:09:51","guid":{"rendered":"https:\/\/www.appblog.cn\/?p=1464"},"modified":"2023-04-28T20:37:21","modified_gmt":"2023-04-28T12:37:21","slug":"nacos-server-deployment-and-operation","status":"publish","type":"post","link":"https:\/\/www.appblog.cn\/index.php\/2023\/03\/24\/nacos-server-deployment-and-operation\/","title":{"rendered":"Nacos\u670d\u52a1\u7aef\u90e8\u7f72\u4e0e\u64cd\u4f5c"},"content":{"rendered":"<h2>\u4ec0\u4e48\u662fNacos<\/h2>\n<p>Nacos \u652f\u6301\u57fa\u4e8e DNS \u548c\u57fa\u4e8e RPC \u7684\u670d\u52a1\u53d1\u73b0\uff08\u53ef\u4ee5\u4f5c\u4e3aspringcloud\u7684\u6ce8\u518c\u4e2d\u5fc3\uff09\u3001\u52a8\u6001\u914d\u7f6e\u670d\u52a1\uff08\u53ef\u4ee5\u505a\u914d\u7f6e\u4e2d\u5fc3\uff09\u3001\u52a8\u6001 DNS \u670d\u52a1\u3002<\/p>\n<p>\u5b98\u65b9\u4ecb\u7ecd\u662f\u8fd9\u6837\u7684\uff1a<\/p>\n<p><!-- more --><\/p>\n<blockquote>\n<p>Nacos \u81f4\u529b\u4e8e\u5e2e\u52a9\u60a8\u53d1\u73b0\u3001\u914d\u7f6e\u548c\u7ba1\u7406\u5fae\u670d\u52a1\u3002Nacos \u63d0\u4f9b\u4e86\u4e00\u7ec4\u7b80\u5355\u6613\u7528\u7684\u7279\u6027\u96c6\uff0c\u5e2e\u52a9\u60a8\u5b9e\u73b0\u52a8\u6001\u670d\u52a1\u53d1\u73b0\u3001\u670d\u52a1\u914d\u7f6e\u7ba1\u7406\u3001\u670d\u52a1\u53ca\u6d41\u91cf\u7ba1\u7406\u3002<br \/>\nNacos \u5e2e\u52a9\u60a8\u66f4\u654f\u6377\u548c\u5bb9\u6613\u5730\u6784\u5efa\u3001\u4ea4\u4ed8\u548c\u7ba1\u7406\u5fae\u670d\u52a1\u5e73\u53f0\u3002 Nacos \u662f\u6784\u5efa\u4ee5\u201c\u670d\u52a1\u201d\u4e3a\u4e2d\u5fc3\u7684\u73b0\u4ee3\u5e94\u7528\u67b6\u6784(\u4f8b\u5982\u5fae\u670d\u52a1\u8303\u5f0f\u3001\u4e91\u539f\u751f\u8303\u5f0f)\u7684\u670d\u52a1\u57fa\u7840\u8bbe\u65bd\u3002<\/p>\n<\/blockquote>\n<p>\u5b98\u65b9\u7f51\u5740\uff1a<a target=\"_blank\" rel=\"noopener\" href=\"http:\/\/nacos.io\">http:\/\/nacos.io<\/a><\/p>\n<h2>Nacos Server<\/h2>\n<h3>\u4e0b\u8f7d\u6e90\u7801\u6216\u8005\u5b89\u88c5\u5305<\/h3>\n<p>\u53c2\u8003\uff1a<a target=\"_blank\" rel=\"noopener\" href=\"https:\/\/nacos.io\/zh-cn\/docs\/quick-start.html\">https:\/\/nacos.io\/zh-cn\/docs\/quick-start.html<\/a><\/p>\n<p>\uff081\uff09\u4ece Github \u4e0a\u4e0b\u8f7d\u6e90\u7801\u65b9\u5f0f<\/p>\n<pre><code>git clone https:\/\/github.com\/alibaba\/nacos.git\ncd nacos\/\nmvn -Prelease-nacos clean install -U  \nls -al distribution\/target\/\n\n\/\/ change the $version to your actual path\ncd distribution\/target\/nacos-server-$version\/nacos\/bin<\/code><\/pre>\n<p>\uff082\uff09\u4e0b\u8f7d\u7f16\u8bd1\u540e\u538b\u7f29\u5305\u65b9\u5f0f<\/p>\n<p>\u4ece <a target=\"_blank\" rel=\"noopener\" href=\"https:\/\/github.com\/alibaba\/nacos\/releases\" title=\"\u6700\u65b0\u7a33\u5b9a\u7248\u672c\">\u6700\u65b0\u7a33\u5b9a\u7248\u672c<\/a> \u4e0b\u8f7d nacos-server-$version.zip \u5305\u3002<\/p>\n<pre><code>unzip nacos-server-$version.zip \u6216\u8005 tar -xvf nacos-server-$version.tar.gz\ncd nacos\/bin<\/code><\/pre>\n<h3>\u542f\u52a8\u670d\u52a1\u5668<\/h3>\n<p>Linux\/Unix\/Mac\u542f\u52a8\u547d\u4ee4(standalone\u4ee3\u8868\u7740\u5355\u673a\u6a21\u5f0f\u8fd0\u884c\uff0c\u975e\u96c6\u7fa4\u6a21\u5f0f):<\/p>\n<pre><code>sh startup.sh -m standalone<\/code><\/pre>\n<p>Windows\u542f\u52a8\u547d\u4ee4\uff1a<\/p>\n<pre><code>cmd startup.cmd<\/code><\/pre>\n<p>\u7a0b\u5e8f\u542f\u52a8\u9ed8\u8ba4\u5360\u7528\u7684\u7aef\u53e3\u662f8848\uff0c\u6211\u4eec\u53ef\u4ee5\u5bf9\u7aef\u53e3\u8fdb\u884c\u4fee\u6539\uff0c\u7528\u7f16\u8f91\u5668\u6253\u5f00bin\u76ee\u5f55\u4e0b\u7684<code>startup.cmd<\/code>\u6587\u4ef6\u4e2d\u6dfb\u52a0\u4e00\u884c\u4ee3\u7801<\/p>\n<pre><code>set &quot;JAVA_OPT=%JAVA_OPT% --server.port=9090<\/code><\/pre>\n<p>\u7aef\u53e3\u53f7\u5373\u6539\u62109090<\/p>\n<p>\u8fd8\u53ef\u4ee5\u5728conf\u6587\u4ef6\u4e0b\u7684<code>application.properties<\/code>\u4e2d\u6dfb\u52a0<\/p>\n<pre><code>server.port=9090<\/code><\/pre>\n<p>\u6765\u4fee\u6539\u7aef\u53e3\u3002\u4e5f\u53ef\u4ee5\u5728\u8be5\u6587\u4ef6\u4e0b\u6307\u5b9a\u6570\u636e\u6e90\uff0c\u65b9\u6cd5\u548cSpring Boot\u4e2d\u914d\u7f6e\u4e00\u6837\uff08\u5355\u673a\u6a21\u5f0f\u6a21\u5f0f\u4e0b\u9ed8\u8ba4\u8fde\u63a5\u7684\u662fjavaDB\uff09\uff0c\u8be5\u6587\u4ef6\u5939\u4e0b <code>nacos-logback.xml<\/code>\u81ea\u7136\u662f\u4fee\u6539nacos\u65e5\u5fd7\u8f93\u51fa\u89c4\u5219\u7684\u3002<\/p>\n<p>\u8bbf\u95ee\u5730\u5740\uff1a<a target=\"_blank\" rel=\"noopener\" href=\"http:\/\/127.0.0.1:8848\/nacos\/index.html\">http:\/\/127.0.0.1:8848\/nacos\/index.html<\/a><\/p>\n<p>\u767b\u5f55\u7528\u6237\u540d\/\u5bc6\u7801\u4e3a\uff1anacos\/nacos<\/p>\n<h3>\u670d\u52a1\u6ce8\u518c&amp;\u53d1\u73b0\u548c\u914d\u7f6e\u7ba1\u7406<\/h3>\n<p>\uff081\uff09\u670d\u52a1\u6ce8\u518c<\/p>\n<pre><code>curl -X POST &#039;http:\/\/127.0.0.1:8848\/nacos\/v1\/ns\/instance?serviceName=nacos.naming.serviceName&amp;ip=20.18.7.10&amp;port=8080&#039;<\/code><\/pre>\n<p>\uff082\uff09\u670d\u52a1\u53d1\u73b0<\/p>\n<pre><code>curl -X GET &#039;http:\/\/127.0.0.1:8848\/nacos\/v1\/ns\/instance\/list?serviceName=nacos.naming.serviceName&#039;<\/code><\/pre>\n<p>\uff083\uff09\u53d1\u5e03\u914d\u7f6e<\/p>\n<pre><code>curl -X POST &quot;http:\/\/127.0.0.1:8848\/nacos\/v1\/cs\/configs?dataId=nacos.cfg.dataId&amp;group=test&amp;content=HelloWorld&quot;<\/code><\/pre>\n<p>\uff084\uff09\u83b7\u53d6\u914d\u7f6e<\/p>\n<pre><code>curl -X GET &quot;http:\/\/127.0.0.1:8848\/nacos\/v1\/cs\/configs?dataId=nacos.cfg.dataId&amp;group=test&quot;<\/code><\/pre>\n<h3>\u5173\u95ed\u670d\u52a1\u5668<\/h3>\n<p>Linux\/Unix\/Mac<\/p>\n<pre><code>sh shutdown.sh<\/code><\/pre>\n<p>Windows<\/p>\n<pre><code>cmd shutdown.cmd<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u4ec0\u4e48\u662fNacos Nacos \u652f\u6301\u57fa\u4e8e DNS \u548c\u57fa\u4e8e RPC \u7684\u670d\u52a1\u53d1\u73b0\uff08\u53ef\u4ee5\u4f5c\u4e3aspringcloud\u7684\u6ce8 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[17],"tags":[],"class_list":["post-1464","post","type-post","status-publish","format-standard","hentry","category-nacos"],"_links":{"self":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts\/1464","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/comments?post=1464"}],"version-history":[{"count":0,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts\/1464\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/media?parent=1464"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/categories?post=1464"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/tags?post=1464"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}