{"id":1235,"date":"2016-05-01T20:32:01","date_gmt":"2016-05-01T12:32:01","guid":{"rendered":"http:\/\/www.myvoipapp.com\/blogs\/yxh\/?p=1235"},"modified":"2023-11-15T10:29:47","modified_gmt":"2023-11-15T02:29:47","slug":"digitalocean%e5%b0%8f%e5%9d%91","status":"publish","type":"post","link":"https:\/\/www.myvoipapp.com\/blogs\/yxh\/2016\/05\/01\/digitalocean%e5%b0%8f%e5%9d%91\/","title":{"rendered":"DigitalOcean\u5c0f\u5751"},"content":{"rendered":"<p><a href=\"https:\/\/m.do.co\/c\/64eb001e2821\" target=\"_blank\" rel=\"noopener\">DigitalOcean<\/a>\u662f\u6211\u4e2a\u4eba\u975e\u5e38\u559c\u6b22\u7684\u4e91\u8ba1\u7b97\u670d\u52a1\u5546\uff0c\u6211\u4eec\u5728\u90e8\u7f72\u81ea\u5df1\u7684\u7f51\u7ad9\u3001\u4e91\u901a\u4fe1\u7cfb\u7edf\u3001\u5411\u5ba2\u6237\u63a8\u8350\u7b49\u5404\u79cd\u60c5\u51b5\u90fd\u4f1a\u91c7\u7528DO\uff08\u4ee5\u53ca<a href=\"https:\/\/www.linode.com\/?r=ffb7ed7011aca11e35b107114218cd37227460c8\" target=\"_blank\" rel=\"noopener\">Linode<\/a>\uff0c\u53e6\u4e00\u4e2a\u975e\u5e38\u4f18\u79c0\u7684\u4e91\u8ba1\u7b97\u670d\u52a1\u5546\uff09\u3002<\/p>\n<p>\u7edd\u5927\u591a\u6570\u60c5\u51b5\u4e0b\uff0cDO\u8282\u70b9\u8fd0\u884c\u975e\u5e38\u5feb\u901f\u3001\u7a33\u5b9a\uff0c\u7136\u800c\u6709\u65f6\u5019\u4e5f\u6709\u610f\u60f3\u4e0d\u5230\u7684\u60c5\u51b5\u53d1\u751f\u3002\u6700\u8fd1\u6211\u4eec\u53d1\u73b0\u4e00\u4e2a\u8282\u70b9\u7684\u670d\u52a1\u7a81\u7136\u4e2d\u65ad\u4e86\uff0c\u7ecf\u68c0\u67e5\u540e\u53d1\u73b0\u662fMySQL\u6570\u636e\u5e93\u5f02\u5e38\u9000\u51fa\uff0c\u9519\u8bef\u539f\u56e0\u662f\u5185\u5b58\u5206\u914d\u4e0d\u8db3\u3002\u4ee5\u524d\u4ece\u672a\u53d1\u751f\u8fc7\u8fd9\u79cd\u60c5\u51b5\uff0c\u7b80\u5355\u5bf9\u6bd4\u540e\u53d1\u73b0\u8fd9\u4e2a\u8282\u70b9\u662f\u4e2a\u5c0f\u5185\u5b58\u8282\u70b9\uff0c\u53ea\u6709512M\u5185\u5b58\uff08\u901a\u5e38\u6211\u4eec\u90fd\u4e3a\u751f\u4ea7\u73af\u5883\u8282\u70b9\u914d\u7f6e2G\u5185\u5b58\uff09\u3002\u6211\u4eec\u8ba4\u4e3a\u8fd9\u4e2a\u8282\u70b9\u7684MySQL\u6570\u636e\u5e93\u4e0d\u5e94\u8be5\u5360\u7528\u592a\u591a\u5185\u5b58\uff0c\u5373\u4fbf512M\u5185\u5b58\u4e0d\u591f\uff0c\u52a0\u4e0aSWAP\u7684\u652f\u6301\u4e5f\u5e94\u8be5\u8db3\u591f\u4e86\u3002<\/p>\n<p>\u7136\u800c\u5206\u6790\u8be5\u8282\u70b9\u4fe1\u606f\uff0c\u60ca\u8bb6\u5730\u53d1\u73b0DO\u9ed8\u8ba4\u5c45\u7136\u6ca1\u6709\u5206\u914dSWAP\u533a\uff08\u4e0e\u4e4b\u5bf9\u6bd4\u7684\u662f\uff0cLinode\u53ef\u4ee5\u5728\u521b\u5efa\u8282\u70b9\u65f6\u6307\u5b9aSWAP\u5206\u533a\uff09\uff01<\/p>\n<p>\u68c0\u7d22\u4e86DO\u7684\u6587\u6863\uff0c\u5bf9\u8fd9\u79cd\u60c5\u51b5\u7684\u89e3\u91ca\u662f\u5efa\u8bae\u91c7\u7528\u66f4\u591a\u5185\u5b58\u7684\u8282\u70b9\uff0cSWAP\u505a\u7f13\u5b58\u4f1a\u62d6\u6162\u7cfb\u7edf\uff0c\u5e76\u53ef\u80fd\u5f71\u54cd\u5176\u4ed6\u7528\u6237\u3002\u539f\u5219\u4e0a\u8fd9\u70b9\u6ca1\u9519\uff0c\u5982\u679c\u9891\u7e41\u53d1\u751f\u5185\u5b58\u4e0d\u591f\u7684\u60c5\u51b5\uff0c\u7684\u786e\u5e94\u4f18\u5148\u5347\u7ea7\u8282\u70b9\uff0c\u91c7\u7528\u66f4\u591a\u5185\u5b58\u3002\u7136\u800c\uff0c\u5982\u679c\u4ec5\u4ec5\u662f\u5728\u5c16\u5cf0\u65f6\u523b\u5076\u5c14\u5c11\u91cf\u5185\u5b58\u4e0d\u8db3\uff0c\u91c7\u7528SWAP\u8fc7\u6e21\u4e00\u4e0b\u5b8c\u5168\u5408\u7406\u3002<\/p>\n<p>\u66f4\u91cd\u8981\u7684\u662f\uff0c\u5373\u4f7fSWAP\u76f8\u5bf9\u800c\u8a00\u6162\u4e00\u4e9b\uff0c\u4f46\u76f8\u6bd4\u7a0b\u5e8fcrash\u800c\u8a00\uff0c\u4e00\u4e2a\u6162\u70b9\u4f46\u662f\u7a33\u5b9a\u7684\u7cfb\u7edf\u663e\u5f97\u66f4\u5408\u7406\u3002\u540c\u65f6\u8003\u8651\u5230DO\u91c7\u7528SSD\u786c\u76d8\uff0c\u901f\u5ea6\u53ef\u4ee5\u63a5\u53d7\uff0c\u56e0\u6b64\u6211\u4eec\u624b\u5de5\u589e\u52a0\u4e862G\u7684SWAP\u8bbe\u7f6e\u3002\u4e8b\u5b9e\u8bc1\u660e\uff0c\u5185\u5b58\u5728\u5fd9\u65f6\u5b9e\u9645\u53ea\u5c11\u4e861M\uff0c\u7528SWAP\u6765\u5e94\u5bf9\u8fd91M\u5185\u5b58\u7684\u9700\u6c42\uff0c\u76f8\u5f53\u5408\u7406\u3002<\/p>\n<p>\u5728DO\u8282\u70b9\u589e\u52a0SWAP\u5f88\u5bb9\u6613\uff0c\u8bf7<a href=\"https:\/\/www.digitalocean.com\/community\/tutorials\/how-to-add-swap-on-ubuntu-14-04\/\" target=\"_blank\" rel=\"noopener\">\u70b9\u51fb\u8fd9\u91cc<\/a>\u4e86\u89e3\u7ec6\u8282\u3002\u6587\u6863\u662f\u57fa\u4e8eUbuntu 14.04\uff0c\u6211\u4eec\u7684\u8282\u70b9\u662fDebian 8\uff0c\u6309\u7167\u8fd9\u7bc7\u6587\u6863\u7684\u4ecb\u7ecd\uff0c\u4e5f\u80fd\u8bbe\u7f6e\u6210\u529f\u3002<\/p>\n\n\n<p>\u4ee5\u4e0b\u662f\u7b80\u8981\u7684\u6b65\u9aa4\u8bb0\u5f55\uff1a<\/p>\n\n\n\n<p>\uff081\uff09\u521b\u5efa swap \u6587\u4ef6\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">sudo fallocate -l 4G \/swapfile<br>sudo chmod 600 \/swapfile<br>sudo mkswap \/swapfile<br>sudo swapon \/swapfile<\/pre>\n\n\n\n<p>\uff082\uff09\u4fee\u6539 \/etc\/fstab \u6587\u4ef6\uff0c\u6dfb\u52a0\u4ee5\u4e0b\u9879\u5373\u53ef\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">\/swapfile none swap sw 0 0<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>DigitalOcean\u662f\u6211\u4e2a\u4eba\u975e\u5e38\u559c\u6b22\u7684\u4e91\u8ba1\u7b97\u670d\u52a1\u5546\uff0c\u6211\u4eec\u5728\u90e8\u7f72\u81ea\u5df1\u7684\u7f51\u7ad9\u3001\u4e91\u901a\u4fe1\u7cfb\u7edf\u3001\u5411\u5ba2\u6237\u63a8\u8350\u7b49\u5404\u79cd\u60c5\u51b5\u90fd\u4f1a\u91c7\u7528DO\uff08\u4ee5\u53caLinode\uff0c\u53e6\u4e00\u4e2a\u975e\u5e38\u4f18\u79c0\u7684\u4e91&#8230;<\/p>\n<p class=\"read-more\"><a class=\"btn btn-default\" href=\"https:\/\/www.myvoipapp.com\/blogs\/yxh\/2016\/05\/01\/digitalocean%e5%b0%8f%e5%9d%91\/\"> Read More<span class=\"screen-reader-text\">  Read More<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6],"tags":[167,503,247,10,505,504],"class_list":["post-1235","post","type-post","status-publish","format-standard","hentry","category-6","tag-crash","tag-do","tag-linode","tag-mysql","tag-prefork","tag-swap"],"_links":{"self":[{"href":"https:\/\/www.myvoipapp.com\/blogs\/yxh\/wp-json\/wp\/v2\/posts\/1235","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.myvoipapp.com\/blogs\/yxh\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.myvoipapp.com\/blogs\/yxh\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.myvoipapp.com\/blogs\/yxh\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.myvoipapp.com\/blogs\/yxh\/wp-json\/wp\/v2\/comments?post=1235"}],"version-history":[{"count":9,"href":"https:\/\/www.myvoipapp.com\/blogs\/yxh\/wp-json\/wp\/v2\/posts\/1235\/revisions"}],"predecessor-version":[{"id":2560,"href":"https:\/\/www.myvoipapp.com\/blogs\/yxh\/wp-json\/wp\/v2\/posts\/1235\/revisions\/2560"}],"wp:attachment":[{"href":"https:\/\/www.myvoipapp.com\/blogs\/yxh\/wp-json\/wp\/v2\/media?parent=1235"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.myvoipapp.com\/blogs\/yxh\/wp-json\/wp\/v2\/categories?post=1235"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.myvoipapp.com\/blogs\/yxh\/wp-json\/wp\/v2\/tags?post=1235"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}