{"id":10007092,"date":"2023-01-17T23:49:33","date_gmt":"2023-01-17T15:49:33","guid":{"rendered":"https:\/\/ityet.com\/?p=10007092"},"modified":"2023-01-17T23:49:33","modified_gmt":"2023-01-17T15:49:33","slug":"%e3%80%90%e6%a1%88%e4%be%8b%e5%88%86%e4%ba%ab%e3%80%91%e5%a6%82%e4%bd%95%e5%88%a9%e7%94%a8%e4%ba%ac%e4%b8%9c%e4%ba%91%e5%bb%ba%e8%ae%be%e9%ab%98%e5%8f%af%e7%94%a8%e4%b8%9a%e5%8a%a1%e6%9e%b6%e6%9e%84","status":"publish","type":"post","link":"https:\/\/itmax.cn\/?p=10007092","title":{"rendered":"\u3010\u6848\u4f8b\u5206\u4eab\u3011\u5982\u4f55\u5229\u7528\u4eac\u4e1c\u4e91\u5efa\u8bbe\u9ad8\u53ef\u7528\u4e1a\u52a1\u67b6\u6784"},"content":{"rendered":"<p><strong>\u4f5c\u8005\uff1a\u4eac\u4e1c\u4e91 \u5f20\u4e45\u5fd7<\/strong><\/p>\n<p>\u672c\u6587\u4ee52022\u5e74\u4e00\u4e2a\u5b9e\u9645\u9879\u76ee\u4e3a\u57fa\u7840\uff0c\u6765\u6f14\u793a\u5728\u4eac\u4e1c\u4e91\u4e0a\u6784\u5efa\u9ad8\u53ef\u7528\u4e1a\u52a1\u7684\u6574\u4e2a\u8fc7\u7a0b\u3002\u516c\u6709\u4e91\u53ca\u79c1\u6709\u4e91\u5ba2\u6237\u53ef\u901a\u8fc7\u4f7f\u7528\u4eac\u4e1c\u4e91\u7684\u5f39\u6027IAAS\u3001PAAS\u670d\u52a1\uff0c\u521b\u5efa\u9ad8\u53ef\u7528\u3001\u9ad8\u5f39\u6027\u3001\u9ad8\u53ef\u6269\u5c55\u3001\u9ad8\u5b89\u5168\u7684\u4e91\u4e0a\u4e1a\u52a1\u73af\u5883\uff0c\u63d0\u5347\u4e1a\u52a1SLA,\u63d0\u5347\u8fd0\u7ef4\u81ea\u52a8\u5316\u6c34\u5e73\uff0c\u964d\u4f4e\u8d44\u6e90\u6210\u672c\u53ca\u8fd0\u7ef4\u6210\u672c\u3002\u6709\u4e1a\u52a1\u8fc1\u79fb\u4e0a\u4e91\u9700\u6c42\uff0c\u5e0c\u671b\u6784\u5efa\u4e91\u4e0a\u9ad8\u53ef\u7528\u4e1a\u52a1\u67b6\u6784\u7684\u5ba2\u6237\u6216\u5bf9\u4e91\u4e0a\u9ad8\u53ef\u7528\u67b6\u6784\u89c4\u5212\u6709\u5174\u8da3\u7684\u8bfb\u8005\u53ef\u4ee5\u4e00\u770b\u3002<\/p>\n<p>\u5ba2\u6237\u4e1a\u52a1\u4e3a\u5178\u578b\u7684web\u5e94\u7528\uff0c\u5728\u4eac\u4e1c\u4e91\u4e0a\u521b\u5efa\u4e00\u4e2a\u901a\u8fc7\u516c\u7f51IP\/\u57df\u540d\u8bbf\u95ee\u7684\u9ad8\u53ef\u7528\u7684web\u7f51\u7ad9\uff0c\u5305\u542b\u901a\u7528\u5e94\u7528\u7684\u6807\u51c6\u6846\u67b6\uff0c\u5305\u62ec\u8bbf\u95ee\u63a5\u5165\u5c42\u3001APP\u5c42\u3001\u7f13\u5b58\u5c42\u3001\u6570\u636e\u5e93\u5c42\u3002\u6574\u4f53\u4e1a\u52a1\u67b6\u6784\u8bbe\u8ba1\u63d0\u4f9b\u53ef\u7528\u533a(AZ)\u7ea7\u522b\u7684\u9ad8\u53ef\u7528\u7b49\u7ea7\u3002<\/p>\n<p><strong>\u672c\u6587\u6f14\u793a\u573a\u666f\u5305\u62ec<\/strong>\u5355AZ\u51fa\u73b0\u6545\u969c\u5bfc\u81f4\u7684\u4e3b\u673a\u6545\u969c\u3001\u6570\u636e\u5e93\u6545\u969c\u3001\u7f13\u5b58\u6545\u969c\u573a\u666f\u4e0b\uff0c\u4e1a\u52a1\u80fd\u591f\u63d0\u4f9b\u6301\u7eed\u8bbf\u95ee\u80fd\u529b\u3002\u5e76\u4fdd\u969c\u6570\u636e\u7684\u5b8c\u6574\u6027\u548c\u4e00\u81f4\u6027\uff0c\u540c\u65f6\uff0c\u80fd\u591f\u5728\u65e0\u4eba\u5e72\u9884\u7684\u6761\u4ef6\u4e0b\uff0c\u5b9e\u73b0\u4e1a\u52a1\u7684\u5f39\u6027\u6269\u5c55\uff0c\u4fdd\u969c\u4e1a\u52a1\u9ad8\u5e76\u53d1\u7684\u573a\u666f\u4e0b\u6709\u826f\u597d\u7684\u54cd\u5e94\u65f6\u95f4\u3002<\/p>\n<p><strong>\u8bf4\u660e\uff1a<\/strong><\/p>\n<p>\u672c\u6587\u7684\u67b6\u6784\u4e3a\u6f14\u793a\u67b6\u6784\uff0c_\u5e76\u672a\u4e25\u683c\u9075\u5faa\u751f\u4ea7\u73af\u5883_\u7684\u4e1a\u52a1\u6027\u80fd\u53ca\u5b89\u5168\u7684\u6574\u4f53\u89c4\u5212\u6b65\u9aa4\u53ca\u8981\u6c42\uff0c\u5728\u751f\u4ea7\u73af\u5883\u4e2d\uff0c\u81f3\u5c11\u5e94\u8be5\u5bf9\u4e3b\u673a\u53caCFS\u7684\u5b58\u50a8\u6027\u80fd\u8fdb\u884c\u538b\u6d4b\uff0c\u786e\u4fdd\u80fd\u591f\u6ee1\u8db3\u5b9e\u9645\u4e1a\u52a1\u9700\u6c42\uff0c\u540c\u65f6\uff0c\u901a\u8fc7\u57df\u540d\u8bbf\u95ee\u7684web\u670d\u52a1\uff0c\u5efa\u8bae\u4f7f\u7528WAF\u7b49\u5b89\u5168\u9632\u62a4\u4ea7\u54c1\uff0c\u4fdd\u969c\u4e1a\u52a1\u7684\u5165\u53e3\u5b89\u5168\u3002<\/p>\n<h2><strong>1<\/strong>\u3001\u4eac\u4e1c\u4e91\u9ad8\u53ef\u7528\u67b6\u6784\u8bbe\u8ba1<\/h2>\n<p>\u4e1a\u52a1\u67b6\u6784\u4ee5\u67d0\u5355\u4f4d\u7684\u4e1a\u52a1\u9700\u6c42\u4e3a\u57fa\u7840\uff0c\u6a21\u62df\u5176\u4e1a\u52a1\u751f\u4ea7\u73af\u5883\uff0c\u89c4\u5212\u4eac\u4e1c\u4e91\u4e0a\u7684\u4e1a\u52a1\u6574\u4f53\u67b6\u6784\uff0c\u5176\u4e2d\uff0c\u00a0 NAT\u7f51\u5173\u3001\u8d1f\u8f7d\u5747\u8861\u3001\u5821\u5792\u673a\u5747\u521b\u5efa\u5728\u516c\u7f51\u8bbf\u95ee\u5b50\u7f51\uff0c\u5176\u4f59\u4e3b\u673a\u53ca\u6570\u636e\u5e93\u7b49\uff0c\u521b\u5efa\u5728\u5185\u90e8\u5b50\u7f51\u5185\u3002<\/p>\n<p><img decoding=\"async\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/remote\/1460000043343363\" alt=\"\" title=\"\" loading=\"lazy\"><\/p>\n<p>\u5176\u4e2d\u5e94\u7528\u4e3b\u673a\u4f7f\u7528\u9ad8\u53ef\u7528\u7ec4\u521b\u5efa\uff0c LB\u540e\u7aef\u76f4\u63a5\u6302\u8f7d\u9ad8\u53ef\u7528\u7ec4\u3002<\/p>\n<p>\u4f7f\u7528\u9ad8\u53ef\u7528\u7ec4\u7684\u76ee\u6807\u662f\u5b9e\u73b0\u4e1a\u52a1\u9ad8\u5cf0\u671f\u6545\u969c\u65f6\uff0c\u8ba1\u7b97\u8d44\u6e90\u80fd\u81ea\u52a8\u52a0\u5165\u8d1f\u8f7d\u5747\u8861\u540e\u7aef\uff0c\u81ea\u52a8\u5316\u6269\u5c55\u4e1a\u52a1\u5904 \u7406\u80fd\u529b\u3002\u51cf\u5c11\u8fd0\u7ef4\u5e72\u9884\u6210\u672c\u3002<\/p>\n<h2>2\u3001<strong>\u8d44\u6e90\u9700<strong><em><em>\u6c42\uff08\u6240\u6709<\/em><\/strong><\/em>IP<strong><em><em>\u53ca<\/em><\/strong><\/em>URL<strong><em><em>\u5747\u8c03\u6574\u4e3a\u975e\u771f\u5b9e<\/em><\/strong><\/em>IP<strong><em><em>\u53ca<\/em><\/strong><\/em>URL<\/strong>\uff09<\/h2>\n<p><img decoding=\"async\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/remote\/1460000043343364\" alt=\"image.png\" title=\"image.png\" loading=\"lazy\"><\/p>\n<h2><strong>3<\/strong>\u3001\u5e94\u7528\u90e8\u7f72<\/h2>\n<h3>3.1 \u57fa\u7840\u73af\u5883\u51c6\u5907<\/h3>\n<p>\u4e1a\u52a1\u4ee5\u4e00\u4e2a\u5178\u578b\u7684wordpress\u7684\u7f51\u7ad9\u4e3a\u4f8b\uff0c\u4e1a\u52a1\u5bb9\u5668\u5316\u90e8\u7f72\u4e8e\u4e91\u4e3b\u673a\u4e0a\uff0c\u9ad8\u53ef\u7528\u4f9d\u8d56\u4eac\u4e1c\u4e91\u7684\u4e91\u4e3b\u673a\u9ad8\u53ef\u7528\u7ec4\uff0c\u4e3b\u673a\u5b89\u88c5docker\uff0c\u5e76\u914d\u7f6edocker\u670d\u52a1\u81ea\u52a8\u542f\u52a8\u3002<\/p>\n<pre><code>#\u521b\u5efa\u5e94\u7528\u6570\u636e\u76ee\u5f55 \u914d\u7f6e\u76ee\u5f55\u6743\u9650\u3001\u5b89\u88c5docker\u7b49\n\n\u00a0mkdir -p \/wp\n\n\u00a0chmod 777 \/wp\n\n\u00a0yum install docker vim -y\n\n\u00a0systemctl enable docker\n\n\u00a0systemctl start docker\n\n\u00a0#\u6302\u8f7dCFS\u6587\u4ef6\u4f5c\u4e3a\u5e94\u7528\u6570\u636e\u76ee\u5f55\n\n\u00a0yum install nfs-utils -y\n\n\u00a0systemctl enable rpcbind \u00a0 \u00a0\n\n\u00a0systemctl start rpcbind\n\n\u00a0mount -t nfs -o vers=3 -o noresvport 10.0.0.200:\/cfs \/wp\n\n#\u914d\u7f6e\u542f\u52a8\u81ea\u52a8\u6302\u8f7dCFS\u53ca\u542f\u52a8\u670d\u52a1\uff0c\u901a\u8fc7rc.local\u5b9e\u73b0\uff1a\n\n#[root@wpha0 wp]# cat \/etc\/rc.local\n\n#!\/bin\/bash\n\n# THIS FILE IS ADDED FOR COMPATIBILITY PURPOSES\n\n#\n\n# It is highly advisable to create own systemd services or udev rules\n\n# to run scripts during boot instead of using this file.\n\n#\n\n# In contrast to previous versions due to parallel execution during boot\n\n# this script will NOT be run after all other services.\n\n#\n\n# Please note that you must run 'chmod +x \/etc\/rc.d\/rc.local' to ensure\n\n# that this script will be executed during boot.\n\ntouch \/var\/lock\/subsys\/local\n\nmount -t nfs -o vers=3 -o noresvport 10.0.0.200:\/cfs \/wp\n\n#\uff08\u8bf4\u660e\uff0c\u751f\u4ea7\u73af\u5883\u53ef\u5728\/etc\/fstab\u6302\u8f7d\uff09\n\nbash \/root\/start.sh\n\nstart.sh\u89c1\u4ee5\u4e0b\u4ee3\u7801\n\n[root@wpha0 wp]# cat \/root\/start.sh\n\ndocker stop wordpress\n\nsleep 3\n\ndocker rm wordpress\n\nsleep 3\n\ndocker run -d --name=wordpress --restart=unless-stopped -p 443:443 -p 80:80 -v \/wp:\/var\/www\/html wordpress\n\n#[root@wpha0 wp]#\n\n#\u542f\u52a8\u811a\u672c\u7f16\u8f91\u5b8c\u6210\u540e\uff0c\u5e76\u5199\u5165rc.local\u540e\uff0crc.local\u8c03\u6574\u6210\u53ef\u6267\u884c\uff0c\u4ee5\u5b9e\u73b0\u542f\u52a8\u4e3b\u673a\u8fd0\u884c\u811a\u672c\uff0c rc.local\u5b9e\u73b0\u4e86\u4e3b\u673a\u542f\u52a8\u540e\u81ea\u52a8\u6302\u8f7dCFS\u5230\u6307\u5b9a\u76ee\u5f55\uff0c\u7136\u540e\uff0c\u901a\u8fc7start.sh\u81ea\u52a8\u6e05\u9664\u65e7\u6570\u636e\uff0c\u91cd\u65b0\u62c9\u8d77wordpress\u670d\u52a1\u3002\n\nchmod +x \/etc\/rc.d\/rc.local\n\n#\u62c9\u53d6\u5e94\u7528\u6240\u9700\u955c\u50cf\n\n\u00a0docker pull wordpress\n\n#\u62c9\u53d6\u955c\u50cf\u540e\uff0c\u8fd0\u884c\u670d\u52a1\u3002\n\ndocker run -d --name=wordpress --restart=unless-stopped \u00a0 \u00a0-p 443:443 -p 80:80 \u00a0-v \/wp:\/var\/www\/html \u00a0wordpress\u00a0<\/code><\/pre>\n<p>\u6ce8\u610f\uff0c\u8fd9\u4e2a\u573a\u666f\u4e0b\uff0c\u4e3b\u8981\u8c03\u6574\u4e86\u51e0\u4e2a\u4f4d\u7f6e\uff1a<\/p>\n<p>1\u3001\u6302\u8f7dCFS\u4e3awordpress\u7684\u5de5\u4f5c\u76ee\u5f55\uff0c\u8fd9\u6837\uff0c\u8c03\u6574\u9875\u9762\u5185\u5bb9\u4ee5\u53ca\u62c9\u8d77\u65b0\u4e3b\u673a\u540e\uff0c\u7f51\u7ad9\u5185\u5bb9\u90fd\u4fdd\u6301\u4e00\u81f4\u3002\u76f8\u5173\u81ea\u52a8\u6302\u8f7d\u65b9\u5f0f\u4e3a\u5728\/etc\/rc.local\u52a0\u5165\u6302\u8f7d\u547d\u4ee4\uff0c\u540c\u65f6chmod +x \/etc\/rc.d\/rc.local \u628a\u8fd9\u4e2a\u6587\u4ef6\u52a0\u4e00\u4e0b\u53ef\u6267\u884c\u6743\u9650\u3002<\/p>\n<p>2\u3001\u9700\u8981\u628awp\u76ee\u5f55\u7684\u6743\u9650\u6539\u4e3a777 \uff08\u6216docker\u5185\u90e8\u7684 33 tape\u7b49\uff0c\u4e0d\u8fc7\u4e0d\u540c\u7248\u672c\u53ef\u80fd\u6709\u533a\u522b\uff0c\u6539\u6210777\u76f8\u5bf9\u7a33\u59a5\uff09\uff0c \u5426\u5219\u6302\u8f7d\u540e\uff0cdocker\u5185\u90e8\u7684wordpress\u65e0\u6cd5\u83b7\u53d6\u76ee\u5f55\u8bfb\u5199\u6743\u9650\u3002<\/p>\n<p>3\u3001NFS\u6302\u8f7d\u9700\u8981\u5b89\u88c5nfs\u63d2\u4ef6 yum install nfs-utils -y \u5e76\u542f\u52a8rpc\u670d\u52a1 systemctl enable rpcbind \u00a0 systemctl start rpcbind<\/p>\n<p>WP\u76ee\u5f55\u4e3a777 \u6743\u9650<\/p>\n<p><img decoding=\"async\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/remote\/1460000043343365\" alt=\"\" title=\"\" loading=\"lazy\"><\/p>\n<p>\u5230\u8fd9\u91cc\u57fa\u7840\u4e3b\u673a\u73af\u5883\u51c6\u5907\u5b8c\u6210\u3002<\/p>\n<p>\u4e0b\u4e00\u6b65\uff0c\u8fdb\u884cwordpress\u5e94\u7528\u7684\u914d\u7f6e\uff0c\u5b9e\u73b0\u9ad8\u53ef\u7528\u53ef\u89c6\u5316\u7684\u6f14\u793a\u6548\u679c\u3002<\/p>\n<h3>3.2 \u4e1a\u52a1\u4fa7 <strong>wordpress<\/strong>\u914d\u7f6e<\/h3>\n<blockquote>\n<p>web\u5e94\u7528\u4f7f\u7528wordpress\u90e8\u7f72\u3002\u901a\u8fc7docker\u90e8\u7f72\uff0c\u5e76\u5b9e\u73b0\u9ad8\u53ef\u7528\u7ec4\u4e3b\u673a\u81ea\u52a8\u4f38\u7f29\u81ea\u52a8\u5316\u62c9\u8d77\u3002<\/p>\n<p>\u901a\u8fc7docker\u62c9\u53d6wordpress<\/p>\n<p>docker pull wordpress<\/p>\n<p>\u62c9\u53d6\u955c\u50cf\u540e<\/p>\n<p>docker run -d &#8211;name=wordpress &#8211;restart=unless-stopped \u00a0 \u00a0-p 443:443 -p 80:80 \u00a0-v \/wp:\/var\/www\/html \u00a0wordpress<\/p>\n<p>\u5176\u4e2d\/wp \u662f\u6302\u8f7d\u7684CFS\uff0c\u4f5c\u4e3a\u591a\u4e2a\u5e94\u7528\u4e3b\u673a\u5171\u540c\u6302\u8f7d\uff0c\u4f5c\u4e3awordpress\u7684\u5e94\u7528\u7684\u5e94\u7528\u6587\u4ef6\u76ee\u5f55\u3002<\/p>\n<p>\u542f\u52a8wordpress\u5bb9\u5668\uff0c\u5e76\u6302\u8f7dCFS\u76ee\u5f55\u4e3aWP\u7684\u5e94\u7528\u76ee\u5f55\u3002<\/p>\n<p>\u4ee5\u4e0a\u90e8\u7f72\u57283.1\u4e2d\u5df2\u7ecf\u5b8c\u6210\u3002<\/p>\n<p>\u524d\u7f6e\u51c6\u5907\u5de5\u4f5c-\u8d1f\u8f7d\u5747\u8861\uff1a<\/p>\n<p>\u914d\u7f6e\u4e00\u4e2a\u5e26\u516c\u7f51IP\u7684\u8d1f\u8f7d\u5747\u8861\uff0c\u5e76\u914d\u7f6e\u76d1\u542c\u5668\uff0c\u76d1\u542c\u5668\u540e\u7aef\u6682\u65f6\u914d\u7f6e\u4e00\u4e2a\u5df2\u7ecf\u62c9\u8d77\u4e86docker\u7684\u8fd9\u53f0\u4e3b\u673a<\/p>\n<p>\u524d\u7f6e\u51c6\u5907\u5de5\u4f5c-\u6570\u636e\u5e93\uff1a<\/p>\n<p>\u5728\u914d\u7f6e\u7f51\u7ad9\u524d\uff0c\u9700\u8981\u9996\u5148\u5728\u4e91\u63a7\u5236\u53f0\u7684RDS\u90a3\u91cc\u4e3awordpress\u521b\u5efa\u4e00\u4e2a\u8d26\u6237\uff1awordpress\uff0c\u5e76\u8bbe\u7f6e\u5bc6\u7801\uff0c\u5efa\u7acb\u4e00\u4e2a\u5e93\uff1awordpress\uff08\u56e0\u4e3a\u540e\u7eed\u6f14\u793a\u65b9\u6848\u6709\u8c03\u6574\uff0c\u6211\u53c8\u521b\u5efa\u4e86\u4e00\u4e2a\u65b0\u5e93wordpressbackup\uff0c\u5b9e\u9645\u6b63\u5e38\u6765\u8bb2\u4e00\u4e2a\u5e93\u5c31\u53ef\u4ee5\u4e86\uff09\uff0c\u5e76\u6388\u6743wordpress\u5e93\u7ed9wordpress\u7528\u6237\u3002<\/p>\n<p>\u524d\u7f6e\u51c6\u5907\u5de5\u4f5c-redis\uff1a<\/p>\n<p>\u5728\u63a7\u5236\u53f0\u8d2d\u4e70\u4e00\u4e2aredis\uff0c\u8bb0\u5f55redis\u7684URL\uff0c\u4e3a\u540e\u7eed\u914d\u7f6eredis \u7f13\u5b58\u505a\u51c6\u5907\u3002<\/p>\n<p>\u8fd9\u6837\uff0c\u57fa\u672c\u7684\u5e94\u7528\u73af\u5883\u5c31\u7eea\u4e86\u3002<\/p>\n<\/blockquote>\n<p>\u901a\u8fc7\u6d4f\u89c8\u5668\u8bbf\u95ee\u8d1f\u8f7d\u5747\u8861(\u6ce8\u610f\u8bbf\u95eeLB\uff0c\u4e0d\u76f4\u63a5\u8bbf\u95ee\u4e3b\u673a)\u7684IP\u768480\u7aef\u53e3\uff0c\u5373\u53ef\u8fdb\u5165wordpress\u7684\u914d\u7f6e \u9875\u9762\uff0c wordpress\u7684\u914d\u7f6e\uff0c\u4e3b\u8981\u662f\u6570\u636e\u5e93\u7684\u5730\u5740\u4ee5\u53ca\u6570\u636e\u5e93\u524d\u7f00\u7684\u914d\u7f6e\uff0c\u8f93\u5165\u6b63\u786e\u7684\u6570\u636e\u5e93\u7684host \u5730\u5740\u53ca\u5bc6\u7801\u5373\u53ef\uff0c\u5176\u4f59\u4fdd\u6301\u9ed8\u8ba4\uff0c\u5176\u4ed6\u4f9d\u636e\u5b98\u7f51\u624b\u518c\u6307\u5bfc\u4fdd\u6301\u9ed8\u8ba4\u914d\u7f6e\u5373\u53ef\u3002<\/p>\n<p>\u914d\u7f6e\u5b8c\u6210\u540e\uff0cwordpress\u4f1a\u81ea\u52a8\u4e3a\u7f51\u7ad9\u521b\u5efa\u76f8\u5173\u7684\u8868\uff0c\u5e76\u63d0\u793a\u914d\u7f6ewordpress\u7684admin\u4ee5\u53ca\u7ba1\u7406\u5bc6\u7801\u3002<\/p>\n<p>\u5b89\u88c5\u5b8c\u6210\u540e\uff0c\u53ef\u4ee5\u767b\u5f55\u6570\u636e\u5e93\u67e5\u770b\u521b\u5efa\u7684\u8868\uff0c\u540e\u7eedMySQL\u9ad8\u53ef\u7528\u6f14\u793a\u65f6\uff0c\u4e5f\u53ef\u4ee5\u767b\u5f55\u5230\u6570\u636e\u5e93\u505a\u4e9b\u5e38\u89c4 \u64cd\u4f5c\uff0c\u4e0d\u53d7\u9ad8\u53ef\u7528\u5207\u6362\u5f71\u54cd\u3002<\/p>\n<p>\u5230\u6b64\uff0c\u57fa\u672c\u7684\u5e94\u7528\u5c31\u5b89\u88c5\u5b8c\u6210\u4e86\u3002<\/p>\n<p><img decoding=\"async\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/remote\/1460000043343366\" alt=\"\" title=\"\" loading=\"lazy\"><\/p>\n<p>\u914d\u7f6e<strong>redis<\/strong>\u52a8\u6001\u7f13\u5b58\u52a0\u901f\uff1a<\/p>\n<p>redis\u7684\u89d2\u8272\uff0c\u5728\u8fd9\u4e2a\u6848\u4f8b\u91cc\u8fb9\uff0c\u5728wordpress\u91cc redis \u4f5c\u4e3a\u4e00\u4e2a\u52a8\u6001\u52a0\u901f\u7f13\u5b58\u4f7f\u7528\uff0c\u5bf9\u52a0\u901f\u7f51\u7ad9\u8bbf\u95ee\uff0c \u51cf\u8f7b\u6570\u636e\u5e93\u538b\u529b\u8d77\u5230\u4e00\u5b9a\u4f5c\u7528\u3002<\/p>\n<p>\u4e0b\u8f7dwordpress\u7684redis\u63d2\u4ef6\uff0credis-cache\u3002<\/p>\n<p>\u4e0b\u8f7d\u540e\u901a\u8fc7wordpress\u7684\u7ba1\u7406\u9875\u9762-plugin &#8211;addnew \u76f4\u63a5\u4e0a\u4f20\uff0c\u7136\u540e\u4f9d\u636e\u63d2\u4ef6\u64cd\u4f5c\u624b\u518c\u5b89\u88c5\u914d\u7f6e\u5373\u53ef\u3002<\/p>\n<p><img decoding=\"async\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/remote\/1460000043343367\" alt=\"\" title=\"\" loading=\"lazy\"><\/p>\n<p>\u5b89\u88c5redis-cache\u4ee5\u540e\uff0c\u4f1a\u5728\/wp\/wp-content\/plugins \u76ee\u5f55\u4e0b\u751f\u6210\u4e00\u4e2a redis-cache\u76ee\u5f55\u3002\u9700\u8981\u540c\u65f6\u5728\/wp\/wp- content \u4e0b\u751f\u6210\u4e00\u4e2a object-cache.php\u6587\u4ef6\uff0c\u6b63\u5e38\u6765\u8bb2\uff0c\u9700\u8981\u8c03\u6574\u4e00\u4e2a\u53c2\u6570host\u6539\u6210redis\u7684\u57df\u540d\u5373\u53ef\u3002\u5982\u679c\u914d\u7f6e\u4e86\u5bc6\u7801\uff0c\u5c31\u9700\u8981\u8c03\u6574\u8fd9\u4e2a\u4ee5\u53caredis-cache\u76ee\u5f55\u4e0b\u7684\u914d\u7f6e\u6587\u4ef6\u628a\u5bc6\u7801\u914d\u7f6e\u8fdb\u53bb\uff0c\u8fd9\u4e2a\u56e0\u4e3a\u662f \u6f14\u793a\u73af\u5883\uff0credis\u8bbe\u7f6e \u4e86\u514d\u5bc6\uff0c\u751f\u4ea7\u73af\u5883\u4e00\u5b9a\u8981\u8bbe\u7f6e\u5bc6\u7801\u3002<\/p>\n<p><img decoding=\"async\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/remote\/1460000043343368\" alt=\"\" title=\"\" loading=\"lazy\"><\/p>\n<p>\u5b89\u88c5\u914d\u7f6e\u5b8c\u6210\u540e\uff0c\u5728\u7ba1\u7406\u754c\u9762\u7684setting\u91cc\u4f1a\u6709redis\u7684\u914d\u7f6e\u9009\u9879\uff0c\u8fd9\u4e2a\u548c\u7248\u672c\u6709\u5173\u7cfb\uff0c\u6709\u4e9b\u7248\u672c\u53ef\u80fd\u4f1a\u8ba9 \u5728\u8fd9\u91cc\u505a\u53c2\u6570\u914d\u7f6e\u3002\u76f4\u63a5\u6539\u6587\u4ef6\u53c2\u6570\u6548\u679c\u662f\u4e00\u6837\u7684\u3002<\/p>\n<p><img decoding=\"async\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/remote\/1460000043343369\" alt=\"\" title=\"\" loading=\"lazy\"><\/p>\n<p><strong>mysql<\/strong>\u53ca<strong>redis<\/strong>\u7ba1\u7406\u53ca\u76f8\u5173\u767b\u5f55\u65b9\u5f0f\u4ecb\u7ecd\uff1a<\/p>\n<blockquote>\n<p>MySQL\u7684\u767b\u5f55\uff0c\u6ca1\u6709\u5b89\u88c5client\uff0c\u4f7f\u7528\u4e86\u4e00\u4e2amysql\u7684docker<\/p>\n<p>\u76f8\u5173\u547d\u4ee4\uff1a<\/p>\n<p>docker run &#8211;name mysql -p 3306:3306 \u00a0&#8211;restart=unless-stopped -v \/root\/dbackup\/:\/db -e MYSQL_ROOT_PASSWORD=123456 -d mysql:5.7<\/p>\n<p>\u8fdb\u5165mysql\u7684docker\u4e2d\uff1a<\/p>\n<p>docker exec -it mysql bash<\/p>\n<p>\u8fde\u63a5wordpress\u4f7f\u7528\u7684\u6570\u636e\u5e93\uff1a<\/p>\n<p>mysql \u00a0-h <a href=\"https:\/\/link.segmentfault.com\/?enc=HN8cwNxLy68JHBDBVWMU8A%3D%3D.GzCI%2B4WUGG9spPjmzZI2kZ95KHzFuTqOt8c1p0ZUTUUDY1I9MIe3cumeBgI6NWel\" rel=\"nofollow\">mysql-xxxea04fc4c52.jdcloud.com<\/a> -u wordpress -p<\/p>\n<p>use wordpressbackup;<\/p>\n<p>show tables;<\/p>\n<p>select id from wpbackup_posts;<\/p>\n<p>&#8211;\u4e2d\u95f4\u56e0\u4e3a\u505a\u4e86\u591a\u6b21\u6f14\u7ec3\u548c\u6570\u636e\u5e93\u5207\u6362\uff0c\u4e2d\u95f4\u505a\u4e86wordpress\u6570\u636e\u5e93\u5bfc\u51fa\u548c\u5bfc\u5165\u64cd\u4f5c<\/p>\n<p>mysql \u6570\u636e\u5e93\u5bfc\u51fa\uff08\u5747\u5728mysql\u7684docker\u5bb9\u5668\u4e2d\u6267\u884c\u547d\u4ee4\uff09\uff1a<\/p>\n<p>mysqldump \u00a0-h \u00a0<a href=\"https:\/\/link.segmentfault.com\/?enc=4yomrpPhM4%2BJW4jRVzmuPQ%3D%3D.VMikAXfS1jfIQN%2F1PuA%2BvzZLMsgg0aeXhIh2qEy72JawPTsauVtFMznvUcbAiigi\" rel=\"nofollow\">mysql-xxxa04fc4c52.jdcloud.com<\/a> -uwordpress -p &#8211;databases wordpressbackup &gt;\/db\/wordpressbackup-0322.sql<\/p>\n<p>\u6570\u636e\u5bfc\u5165\uff1a<\/p>\n<p>\u8fdb\u5165\u6570\u636e\u5e93\uff0c<\/p>\n<p>use wordpressbackup;<\/p>\n<p>source \/db\/wordpressbackup-0322.sql;<\/p>\n<p>&#8212;-redis\u9a8c\u8bc1<\/p>\n<p>redis\u9a8c\u8bc1\uff0c\u540c\u6837\u662f\u6ca1\u6709\u5b89\u88c5client\uff0c\u901a\u8fc7docker\u91cc\u7684\u547d\u4ee4\u884c\u53bb\u8fde\u63a5\uff1a<\/p>\n<p>docker run -d &#8211;name redis &#8211;memory=1G -p 7379:6379 \u00a0 redis<\/p>\n<p>docker exec -it redis bash<\/p>\n<p>redis-cli -h <a href=\"https:\/\/link.segmentfault.com\/?enc=UMH45CWbDpnvsFKsi6hyfA%3D%3D.mEFbTCunmXnAuhYsezZqJVQNoXnjQULY39tLPnw6oDKB0%2FXUXNNSoj2e6Q3r%2BJt%2F\" rel=\"nofollow\">redis-j49rpxxx.jdcloud.com<\/a><\/p>\n<p>\u767b\u5165\u540e\uff0c\u67e5\u770b\u4fe1\u606f\uff1a<\/p>\n<p>KEYS *<\/p>\n<\/blockquote>\n<p><strong>wordpress<\/strong>\u914d\u7f6e\u4e3b\u9875\u663e\u793a<strong>hostname<\/strong>\u53ca\u6765\u6e90<strong>IP<\/strong><\/p>\n<p>&#8212;\u8ba9wordpress\u83b7\u53d6hostname \u5e76\u5728\u9875\u9762\u5c55\u793a+\u83b7\u53d6\u8bbf\u5ba2\u5730\u5740\uff0c\u4ee5\u589e\u5f3a\u6f14\u793a\u6548\u679c\uff0c\u660e\u786e\u770b\u5230\u8bbf\u95ee\u7684\u5b9e\u9645\u4e3b \u673a\u4f4d\u7f6e\u3002<\/p>\n<p>\u4e3a\u4e86\u8ba9\u8bbf\u95ee\u8005\u770b\u5230\u8bbf\u95ee\u7684IP\u662f\u54ea\u4e2a\uff08\u8bc1\u5b9e\u9ad8\u53ef\u7528\u7ec4\u7684\u81ea\u52a8\u6269\u5bb9\u53ca\u4e1a\u52a1\u7684\u81ea\u52a8\u62c9\u8d77\uff09\uff0c\u9700\u8981\u5728\u6240\u4f7f\u7528\u7684 theme \u76ee\u5f55\u7684function\u91cc\u52a0\u5165\u76f8\u5173\u4ee3\u7801\u3002\u00a0 \/wp\/wp- content\/themes\/twentytwentytwo\/function.php<\/p>\n<p>[root@AG-wordpress- HA-group1-c8705-2 twentytwentytwo]# vim \/wp\/wp-content\/themes\/twentytwentytwo\/function.php<\/p>\n<p>\u5728\u91cc\u8fb9\u52a0\u5165\u4ee5\u4e0b\u4ee3\u7801\uff0c\u4e00\u4e2a\u662fshow_ip\u51fd\u6570\uff0c\u4e00\u4e2a\u662fshow_hostname\u51fd\u6570\u3002<\/p>\n<pre><code>function get_the_user_ip() {\nif ( ! empty( $_SERVER[&quot;HTTP_CLIENT_IP&quot;] ) ) {\n\/\/check ip from share internet\n$ip = $_SERVER[&quot;HTTP_CLIENT_IP&quot;];\n} elseif ( ! empty( $_SERVER[&quot;HTTP_X_FORWARDED_FOR&quot;] ) ) {\n\/\/to check ip is pass from proxy\n$ip = $_SERVER[&quot;HTTP_X_FORWARDED_FOR&quot;];\n} else {\n$ip = $_SERVER[&quot;REMOTE_ADDR&quot;];\n}\nreturn apply_filters( &quot;wpb_get_ip&quot;, $ip );\n}\nadd_shortcode(&quot;show_ip&quot;, &quot;get_the_user_ip&quot;);\n\nfunction get_hostname()\n{\n     $hostname = gethostname();\n          echo &quot;$hostname\/n&quot;;\n      return apply_filters( &quot;hostname&quot;, $hostname );\n}\n\nadd_shortcode(&quot;show_hostname&quot;, &quot;get_hostname&quot;);<\/code><\/pre>\n<p>\u7136\u540e\uff0c\u5728wordpress\u7684site\u91cc\u52a0\u5165\u77ed\u4ee3\u7801\u5b9e\u73b0\uff1a<\/p>\n<p><img decoding=\"async\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/remote\/1460000043343370\" alt=\"\" title=\"\" loading=\"lazy\"><\/p>\n<p>\u4fdd\u5b58\u540e\uff0c\u770b\u5230\u9875\u9762\u53ef\u4ee5\u663e\u793a\u76f8\u5173\u7684IP\u53cahostname\u4fe1\u606f\u4e86\u3002<\/p>\n<p><img decoding=\"async\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/remote\/1460000043343371\" alt=\"\" title=\"\" loading=\"lazy\"><\/p>\n<p>\u5230\u8fd9\u91cc\uff0c\u00a0 wordpress\u7684\u5e94\u7528\u73af\u5883\u914d\u7f6e\u5b8c\u6210\u3002<\/p>\n<p>\u4e0b\u4e00\u6b65\u914d\u7f6e\u4e1a\u52a1\u7684\u9ad8\u53ef\u7528\u73af\u5883\uff0c\u5b9e\u73b0\u8de8AZ\u7684\u9ad8\u53ef\u7528\u7ec4\u53ca\u4e3b\u673a\u81ea\u52a8\u5f39\u6027\u4f38\u7f29\u3002<\/p>\n<h3><strong>3<\/strong>.<strong>3<\/strong> \u5b9e\u4f8b\u6a21\u677f\u53ca\u9ad8\u53ef\u7528\u7ec4\u3001<strong>LB<\/strong>\u914d\u7f6e<\/h3>\n<p>\u5355\u53f0\u4e3b\u673a\u914d\u7f6e\u5b8c\u6210\u540e\uff0c\u91cd\u542f\u80fd\u81ea\u52a8\u62c9\u8d77\u5e94\u7528\uff0c\u8fdb\u884c\u786e\u8ba4\u540e\uff0c \u5c06\u73b0\u6709\u4e3b\u673a\u6253\u4e00\u4e2a\u955c\u50cf\u3002\u4f5c\u4e3a\u9ad8\u53ef\u7528\u7ec4\u7684\u5b9e\u4f8b\u6a21\u677f\u3002\u540e\u7eedLB\u540e\u7aef\u7684\u9ad8\u53ef\u7528\u7ec4\u901a\u8fc7\u8fd9\u4e2a\u6a21\u677f\u521b\u5efa\u4e3b\u673a\u3002<\/p>\n<p>\u5176\u4f59\u5305\u62ec\u6570\u636e\u5e93\u914d\u7f6e\u3001\u7f51\u7ad9\u6570\u636e\u3001redis\u7f13\u5b58\u914d\u7f6e\u7b49\uff0c\u5747\u5b9e\u73b0\u4e86\u670d\u52a1\u53ca\u6570\u636e\u7684\u5206\u79bb\uff0c\u56e0\u6b64\uff0c\u5728\u540e\u671f\u8fdb\u884c\u52a8 \u6001\u5f39\u6027\u6269\u5bb9\u65f6\uff0c\u4f7f\u7528\u8fd9\u4e2a\u6a21\u677f\u7684\u9ad8\u53ef\u7528\u7ec4\uff0c\u53ef\u4ee5\u76f4\u63a5\u62c9\u8d77\u670d\u52a1\uff0c\u5b9e\u73b0\u52a8\u6001\u5f39\u6027\u4f38\u7f29\u3002<\/p>\n<p>\u5b9e\u4f8b\u6a21\u677f\uff1a<\/p>\n<p><img decoding=\"async\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/remote\/1460000043343372\" alt=\"\" title=\"\" loading=\"lazy\"><\/p>\n<p><img decoding=\"async\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/remote\/1460000043343373\" alt=\"\" title=\"\" loading=\"lazy\"><\/p>\n<p>\u9ad8\u53ef\u7528\u7ec4\uff1a<\/p>\n<p>\u9ad8\u53ef\u7528\u7ec4\u4f7f\u7528\u5236\u4f5c\u597d\u4e86wordpress\u7684\u5e94\u7528\u4e3b\u673a\u7684\u955c\u50cf\u3002\u505a\u5230\u9ad8\u53ef\u7528\u7ec4\u81ea\u52a8\u5f39\u6027\u4f38\u7f29\u51fa\u65b0\u4e3b\u673a&#8211;\u65b0\u4e3b\u673a\u81ea\u52a8 \u62c9\u8d77wordpress\u5e94\u7528&#8211;\u65b0\u4e3b\u673a\u81ea\u52a8\u6302\u8f7d\u5230LB\u63a5\u6536\u4e1a\u52a1\u6d41\u91cf\u7684\u6a21\u5f0f\u3002<\/p>\n<p><img decoding=\"async\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/remote\/1460000043343374\" alt=\"\" title=\"\" loading=\"lazy\"><\/p>\n<p><img decoding=\"async\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/remote\/1460000043343375\" alt=\"\" title=\"\" loading=\"lazy\"><\/p>\n<p><img decoding=\"async\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/remote\/1460000043343376\" alt=\"\" title=\"\" loading=\"lazy\"><\/p>\n<p><strong>LB<\/strong>\u914d\u7f6e\u3002<\/p>\n<p>LB\u76d1\u542c\u5668\u9009\u62e9\u540e\u7aef\u670d\u52a1\u4e3a\u9ad8\u53ef\u7528\u7ec4\uff0c\u5e76\u914d\u7f6e\u5065\u5eb7\u68c0\u67e5\u3002<\/p>\n<p><img decoding=\"async\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/remote\/1460000043343377\" alt=\"\" title=\"\" loading=\"lazy\"><\/p>\n<p><img decoding=\"async\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/remote\/1460000043343378\" alt=\"\" title=\"\" loading=\"lazy\"><\/p>\n<p>\u9ad8\u53ef\u7528\u7ec4\u6302\u8f7d\u5230LB\u540e\u7aef\u4ee5\u540e\uff0c\u5e94\u7528\u73af\u5883\u5df2\u7ecf\u642d\u5efa\u5b8c\u6210\u3002<\/p>\n<p>\u53ef\u4ee5\u8bbf\u95eeLB\u5165\u53e3\uff0c\u8bbf\u95ee\u5230\u7f51\u7ad9\uff0c\u5e76\u4e14\u4f1a\u8f6e\u8be2\u5230\u4e0d\u540c\u670d\u52a1\u5668\uff0c\u540c\u65f6\uff0c\u8bbf\u95ee\u5355\u53f0\u670d\u52a1\u5668\u7684\u5916\u7f51IP \u4e5f\u53ef\u4ee5\u8bbf\u95ee\u7f51\u7ad9\u4e1a\u52a1\uff1a<\/p>\n<p>LB\u8bbf\u95ee\u622a\u56fe(2\u5f20\uff0c\u5206\u522b\u8bbf\u95ee\u5230\u4e86\u4e24\u4e2a\u4e3b\u673a)<\/p>\n<p><img decoding=\"async\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/remote\/1460000043343379\" alt=\"\" title=\"\" loading=\"lazy\"><\/p>\n<p><img decoding=\"async\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/remote\/1460000043343380\" alt=\"\" title=\"\" loading=\"lazy\"><\/p>\n<p>\u5355\u53f0\u4e3b\u673a\u8bbf\u95ee\u622a\u56fe\uff08\u76f4\u63a5\u8bbf\u95ee\u5355\u53f0\u4e3b\u673aIP\uff0c\u5237\u65b0\u540e\u4e0d\u4f1a\u8f6e\u8be2\u4e3b\u673a\uff09\uff1a<\/p>\n<p><img decoding=\"async\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/remote\/1460000043343381\" alt=\"\" title=\"\" loading=\"lazy\"><\/p>\n<p>\u6f14\u793a\u73af\u5883\u5c31\u7eea\u3002<\/p>\n<p>\u4e0b\u4e00\u6b65\uff0c\u8fdb\u884c\u7834\u574f\u6027\u6f14\u7ec3\uff0c\u68c0\u9a8c\u9ad8\u53ef\u7528\u73af\u5883\u7684\u6548\u679c\u3002<\/p>\n<h2><strong>4<\/strong>\u3001\u5e94\u7528\u6f14\u793a<\/h2>\n<p>\u9ad8\u53ef\u7528\u6f14\u793a\u811a\u672c\uff1a<\/p>\n<p><img decoding=\"async\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/remote\/1460000043343382\" alt=\"image.png\" title=\"image.png\" loading=\"lazy\"><\/p>\n<p>\u9ad8\u53ef\u7528\u7ec4\u4fe1\u606f\uff0c\u76ee\u524dLB\u540e\u7aef\u6302\u8f7d\u7684\u4e3a\u9ad8\u53ef\u7528\u7ec4\uff1a<\/p>\n<p>\u6d4b\u8bd5\u9875\u9762\u4fe1\u606f\uff08\u6240\u6709IP\u5747\u4e3a\u975e\u771f\u5b9eIP\uff09\uff1a<\/p>\n<p>\u4e1a\u52a1\u5165\u53e3(LB)\uff1a\u00a0\u00a0 <a href=\"https:\/\/link.segmentfault.com\/?enc=qRbRQJOvqAFxNbq5qFXOgw%3D%3D.peuFtl29g7MUh%2F73MtVuDuBwmiBrezbLYEK%2F2H%2BTTPw%3D\" rel=\"nofollow\">http:\/\/100.126.35.4\/<\/a><\/p>\n<p>\u9ad8\u53ef\u7528\u7ec4\u5355\u53f0\u4e3b\u673a\u8bbf\u95ee\u5165\u53e3\u76ee\u524d\u4e3a\uff1a<\/p>\n<p><a href=\"https:\/\/link.segmentfault.com\/?enc=%2B5WyTuT%2FNJ1BSvcwjNlbLw%3D%3D.llKFRkXMtAwsTCLFPKaBCLasgyt4QZoUbWTeBkaKf4Q%3D\" rel=\"nofollow\">http:\/\/100.126.38.13\/<\/a><\/p>\n<p><a href=\"https:\/\/link.segmentfault.com\/?enc=nDtmLUUbKJRORJjTUKcXJg%3D%3D.di51WK3D6UgPGqoB7X80H2OXmFiGEjE1NLXDIsVfzQI%3D\" rel=\"nofollow\">http:\/\/100.126.38.16<\/a><\/p>\n<p>\u4e3b\u673a\u7684\u9ad8\u53ef\u7528\u53ca\u81ea\u52a8\u4f38\u7f29\uff1a<\/p>\n<p>\u6f14\u793a\u6240\u9700\u7684\u4e00\u4e9b\u811a\u672c\uff1a<\/p>\n<p>\u4e00\u4e2a\u662f\u6a21\u62df\u751f\u4ea7\u73af\u5883\uff0c\u5bf9\u4e1a\u52a1\u4e3b\u5165\u53e3\u7684LB\u6301\u7eed\u8bbf\u95ee\uff0c\u8fd9\u4e2a\u5728\u6d4b\u8bd5\u8fc7\u7a0b\u4e2d\uff0c\u4e00\u76f4\u53ef\u4ee5\u8bbf\u95ee\u5230\uff0c\u4e0d\u4f1a\u4e2d\u65ad\u3002<\/p>\n<pre><code>#!\/bin\/bash\n#for ((i=1;i&lt;=10;i++))\nfor i in {1..15000}\n do\ncurl 100.126.35.4\necho $i\necho $(date +%T)\nsleep 3\n  done<\/code><\/pre>\n<p>![]()<img decoding=\"async\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/remote\/1460000041378096\" alt=\" title=\"\u70b9\u51fb\u5e76\u62d6\u62fd\u4ee5\u79fb\u52a8\"\" title=\" title=\"loading =lazy><\/p>\n<p>\u4e00\u4e2a\u662f\u6a21\u62df\u5355\u673a\u73af\u5883\uff0c\u5bf9\u4e1a\u4e3b\u673a\u5165\u53e3\u7684\u6301\u7eed\u8bbf\u95ee\uff0c\u8fd9\u4e2a\u5728\u6d4b\u8bd5\u8fc7\u7a0b\u4e2d\uff0c\u5f53\u9488\u5bf9\u5355\u673a\u5173\u673a\u65f6\uff0c\u8bbf\u95ee\u4f1a\u5361\u4f4f\u3002<\/p>\n<pre><code>#!\/bin\/bash\n\n#for ((i=1;i&lt;=10;i++))\n\nfor i in {1..15000}\n\n\u00a0do\n\ncurl 100.126.38.16\n\necho $i\n\necho $(date +%T)\n\nsleep 3\n\n\u00a0 done<\/code><\/pre>\n<p>\u6f14\u793a\u8fc7\u7a0b\u4e2d\uff0c\u9ad8\u53ef\u7528\u7ec4\u81ea\u52a8\u4f38\u7f29\u529f\u80fd\uff0c\u80fd\u6b63\u5e38\u6269\u5bb9\u51fa\u65b0\u7684\u4e3b\u673a\u5e76\u63d0\u4f9b\u4e1a\u52a1\u8bbf\u95ee\u3002<\/p>\n<p>\u9ad8\u53ef\u7528\u7ec4\u7684\u81ea\u52a8\u4f38\u7f29\uff0c\u901a\u8fc7 stress\u6a21\u62df\u538b\u529b<\/p>\n<blockquote>\n<p>\u5b89\u88c5stress\u540e\uff0c\u76f4\u63a5\u8fd0\u884c\uff08\u4e3b\u673a\u4e3a2C\uff09\uff1a<\/p>\n<p>stress &#8211;CPU 2<\/p>\n<p>\u901a\u8fc7top\u547d\u4ee4\u53ef\u4ee5\u770b\u5230CPU\u88ab\u6253\u6ee1\u3002<\/p>\n<p>\u8fc72\u5206\u949f\uff08\u9ad8\u53ef\u7528\u7ec4\u4f38\u7f29\u7b56\u7565\u914d\u7f6e\u7684\u65f6\u95f4\uff09\uff0c\u9ad8\u53ef\u7528\u7ec4\u4f1a\u81ea\u52a8\u6269\u5c55\u4e00\u53f0\u4e3b\u673a\uff0c\u5e76\u4f5c\u4e3a\u9ad8\u53ef\u7528\u7ec4\u7684\u4e00\u53f0\u4e3b\u673a\u81ea\u52a8\u6302\u8f7d\u5230LB\u7684\u540e\u7aef\uff0c\u53ef\u5728LB\u53ca\u4e3b\u673a\u754c\u9762\u770b\u5230\u81ea\u52a8\u6269\u5bb9\u7684\u4e3b\u673a\u3002<\/p>\n<\/blockquote>\n<p><img decoding=\"async\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/remote\/1460000043343383\" alt=\"\" title=\"\" loading=\"lazy\"><\/p>\n<p>\u5728\u63a7\u5236\u53f0\u5c06\u4e00\u53f0\u9ad8\u53ef\u7528\u7ec4\u5185\u4e3b\u673a\u5173\u673a\uff0c\u7136\u540e\u53ef\u89c1LB\u540e\u7aef\u670d\u52a1\u5065\u5eb7\u68c0\u67e5\u53d1\u73b0\u6302\u8f7d\u7684\u9ad8\u53ef\u7528\u7ec4\u4e00\u53f0\u670d\u52a1\u5668\u5f02\u5e38\uff0c\u9ad8\u53ef\u7528\u7ec4\u5982\u914d\u7f6e\u6700\u5c0f\u7684\u4e3b\u673a\u6570\u91cf\uff0c\u5219\u9ad8\u53ef\u7528\u7ec4\u4e5f\u81ea\u52a8\u6269\u51fa\u4e00\u53f0\u4e3b\u673a\uff0c\u7ee7\u7eed\u63d0\u4f9b\u670d\u52a1\u3002\u5728\u6b64\u671f\u95f4\uff0c\u6d41\u91cf\u4f1a\u8f6c\u53d1\u7ed9\u540e\u7aef\u6b63\u5e38\u4e3b\u673a\uff0c\u5065\u5eb7\u68c0\u67e5\u5f02\u5e38\u7684\u4e3b\u673a\u4e0d\u518d\u63a5\u6536\u6d41\u91cf\uff0c\u4e1a\u52a1\u8bbf\u95ee\u6301\u7eed\u6b63\u5e38\u3002<\/p>\n<p><img decoding=\"async\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/remote\/1460000043343384\" alt=\"\" title=\"\" loading=\"lazy\"><\/p>\n<p><img decoding=\"async\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/remote\/1460000043343385\" alt=\"\" title=\"\" loading=\"lazy\"><\/p>\n<p><strong>PAAS<\/strong>\u670d\u52a1\u7684\u9ad8\u53ef\u7528\uff1a<\/p>\n<p>\u672c\u6f14\u793a\u4ee5MySQL\u53caredis\u7814\u53d1\u5728\u5e95\u5c42\u76f4\u63a5\u6740docker\uff0c\u7136\u540e\u4e1a\u52a1\u8bbf\u95ee\u4e0d\u4e2d\u65ad\uff0c\u63a7\u5236\u53f0\u4e0a\u4f1a\u51fa\u73b0\u4e3b\u4ece\u5207\u6362\u73b0\u8c61\u5728\u8fd9\u4e2a\u8fc7\u7a0b\u4e2d\u5bf9\u4e1a\u52a1\u7684\u8bbf\u95ee\u4e0d\u4f1a\u4e2d\u65ad\u3002<\/p>\n<p>\u4e91\u6570\u636e\u5e93\u53ca\u7f13\u5b58\u7684\u7834\u574f\u6027\u64cd\u4f5c\uff0c\u5e95\u5c42\u64cd\u4f5c\u7531\u7814\u53d1\u64cd\u4f5c\u3002<\/p>\n<p>\u5e95\u5c42\u8fdb\u884cRDS\u4e3b\u5907\u5207\u6362\uff08kill\u6389RDS\u4e3b\u5e93\uff09\uff0c\u4e1a\u52a1\u8bbf\u95ee\u540c\u6837\u4e0d\u4f1a\u4e2d\u65ad\uff0c\u7814\u53d1\u63d0\u4f9b\u622a\u56fe\u53ef\u4ee5\u770b\u5230\u4e3b\u4ece\u5207\u6362\u8fc7\u7a0b\u3002<\/p>\n<p><img decoding=\"async\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/remote\/1460000043343386\" alt=\"\" title=\"\" loading=\"lazy\"><\/p>\n<p><img decoding=\"async\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/remote\/1460000043343387\" alt=\"\" title=\"\" loading=\"lazy\"><\/p>\n<p>\u672c\u6587\u5b9e\u9645\u90e8\u7f72\u73af\u5883\u4e3a\u4eac\u4e1c\u4e3a\u5ba2\u6237\u642d\u5efa\u7684\u79c1\u6709\u4e91\u73af\u5883\uff08JDSTACK\uff09\uff0c\u516c\u6709\u4e91\u4e0e\u79c1\u6709\u4e91\u4e3a\u76f8\u540c\u6280\u672f\u6808\uff0c\u642d\u5efa\u53ca\u9a8c\u8bc1\u8fc7\u7a0b\u76f8\u4f3c\u3002\u9650\u4e8e\u7bc7\u5e45\uff0credis\u9a8c\u8bc1\u90e8\u5206\u53ca\u4e3b\u673a\u53ef\u8bbf\u95ee\u6027\u811a\u672c\u7ed3\u679c\u672a\u622a\u56fe\uff0c\u611f\u5174\u8da3\u7684\u8bfb\u8005\u53ef\u81ea\u884c\u5728\u4e91\u4e0a\u901a\u8fc7\u672c\u6587\u6307\u5f15\u8fc7\u7a0b\u642d\u5efa\u9a8c\u8bc1\u3002<\/p>\n<p>\u200b<\/p>\n<p><a href=\"https:\/\/segmentfault.com\/a\/1190000043343361\">https:\/\/segmentfault.com\/a\/1190000043343361<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4f5c\u8005\uff1a\u4eac\u4e1c\u4e91 \u5f20\u4e45\u5fd7 \u672c\u6587\u4ee52022\u5e74\u4e00\u4e2a\u5b9e\u9645\u9879\u76ee\u4e3a\u57fa\u7840\uff0c\u6765\u6f14\u793a\u5728\u4eac\u4e1c\u4e91\u4e0a\u6784\u5efa\u9ad8\u53ef\u7528\u4e1a\u52a1\u7684\u6574\u4e2a\u8fc7\u7a0b\u3002\u516c\u6709\u4e91\u53ca\u79c1 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[4],"tags":[],"class_list":["post-10007092","post","type-post","status-publish","format-standard","hentry","category-share"],"jetpack_sharing_enabled":true,"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/itmax.cn\/index.php?rest_route=\/wp\/v2\/posts\/10007092","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/itmax.cn\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/itmax.cn\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/itmax.cn\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/itmax.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=10007092"}],"version-history":[{"count":0,"href":"https:\/\/itmax.cn\/index.php?rest_route=\/wp\/v2\/posts\/10007092\/revisions"}],"wp:attachment":[{"href":"https:\/\/itmax.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=10007092"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/itmax.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=10007092"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/itmax.cn\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=10007092"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}