{"id":153621,"date":"2024-11-02T08:58:18","date_gmt":"2024-11-02T00:58:18","guid":{"rendered":"https:\/\/server.hk\/cnblog\/153621\/"},"modified":"2024-11-02T08:58:19","modified_gmt":"2024-11-02T00:58:19","slug":"%e5%a4%a7%e6%95%b8%e6%93%9a%e6%b5%aa%e6%bd%ae%e4%b8%8b%e7%9a%84%e6%95%b8%e6%93%9a%e5%ba%ab%e6%87%89%e7%94%a8%e7%a8%8b%e5%ba%8f-%e5%a4%a7%e6%95%b8%e6%93%9a%e5%b0%8d%e6%95%b8%e6%93%9a%e5%ba%ab%e7%9a%84","status":"publish","type":"post","link":"https:\/\/server.hk\/cnblog\/153621\/","title":{"rendered":"\u5927\u6578\u64da\u6d6a\u6f6e\u4e0b\u7684\u6578\u64da\u5eab\u61c9\u7528\u7a0b\u5e8f (\u5927\u6578\u64da\u5c0d\u6578\u64da\u5eab\u7684\u61c9\u7528\u7a0b\u5e8f)"},"content":{"rendered":"<h1 id=\"%e5%a4%a7%e6%95%b8%e6%93%9a%e6%b5%aa%e6%bd%ae%e4%b8%8b%e7%9a%84%e6%95%b8%e6%93%9a%e5%ba%ab%e6%87%89%e7%94%a8%e7%a8%8b%e5%ba%8f-VkUOurcDZA\">\u5927\u6578\u64da\u6d6a\u6f6e\u4e0b\u7684\u6578\u64da\u5eab\u61c9\u7528\u7a0b\u5e8f<\/h1>\n<p>\u96a8\u8457\u79d1\u6280\u7684\u8fc5\u901f\u767c\u5c55\uff0c\u5927\u6578\u64da\u5df2\u6210\u70ba\u7576\u4eca\u4f01\u696d\u548c\u7d44\u7e54\u4e2d\u4e0d\u53ef\u6216\u7f3a\u7684\u4e00\u90e8\u5206\u3002\u5927\u6578\u64da\u7684\u51fa\u73fe\u4e0d\u50c5\u6539\u8b8a\u4e86\u6578\u64da\u7684\u6536\u96c6\u548c\u5b58\u5132\u65b9\u5f0f\uff0c\u4e5f\u5c0d\u6578\u64da\u5eab\u61c9\u7528\u7a0b\u5e8f\u7684\u8a2d\u8a08\u548c\u5be6\u73fe\u63d0\u51fa\u4e86\u65b0\u7684\u6311\u6230\u548c\u6a5f\u9047\u3002\u672c\u6587\u5c07\u63a2\u8a0e\u5927\u6578\u64da\u5c0d\u6578\u64da\u5eab\u61c9\u7528\u7a0b\u5e8f\u7684\u5f71\u97ff\uff0c\u4e26\u5206\u6790\u5982\u4f55\u5728\u9019\u4e00\u6d6a\u6f6e\u4e2d\u6709\u6548\u5229\u7528\u6578\u64da\u5eab\u6280\u8853\u3002<\/p>\n<h2 id=\"%e5%a4%a7%e6%95%b8%e6%93%9a%e7%9a%84%e5%ae%9a%e7%be%a9%e8%88%87%e7%89%b9%e5%be%b5-VkUOurcDZA\">\u5927\u6578\u64da\u7684\u5b9a\u7fa9\u8207\u7279\u5fb5<\/h2>\n<p>\u5927\u6578\u64da\u901a\u5e38\u6307\u7684\u662f\u8d85\u51fa\u50b3\u7d71\u6578\u64da\u8655\u7406\u80fd\u529b\u7684\u6578\u64da\u96c6\uff0c\u9019\u4e9b\u6578\u64da\u96c6\u5177\u6709\u4ee5\u4e0b\u5e7e\u500b\u7279\u5fb5\uff1a<\/p>\n<ul>\n<li><strong>\u9ad4\u91cf\u5927\uff1a<\/strong>\u6578\u64da\u91cf\u9f90\u5927\uff0c\u901a\u5e38\u4ee5TB\u751a\u81f3PB\u8a08\u7b97\u3002<\/li>\n<li><strong>\u901f\u5ea6\u5feb\uff1a<\/strong>\u6578\u64da\u751f\u6210\u548c\u8655\u7406\u7684\u901f\u5ea6\u6975\u5feb\uff0c\u5be6\u6642\u6027\u8981\u6c42\u9ad8\u3002<\/li>\n<li><strong>\u591a\u6a23\u6027\uff1a<\/strong>\u6578\u64da\u4f86\u6e90\u591a\u6a23\uff0c\u5305\u62ec\u7d50\u69cb\u5316\u6578\u64da\u3001\u534a\u7d50\u69cb\u5316\u6578\u64da\u548c\u975e\u7d50\u69cb\u5316\u6578\u64da\u3002<\/li>\n<li><strong>\u50f9\u503c\u5bc6\u5ea6\u4f4e\uff1a<\/strong>\u5728\u5927\u91cf\u6578\u64da\u4e2d\uff0c\u771f\u6b63\u6709\u50f9\u503c\u7684\u4fe1\u606f\u5f80\u5f80\u4f54\u6bd4\u4e0d\u9ad8\u3002<\/li>\n<\/ul>\n<h2 id=\"%e5%a4%a7%e6%95%b8%e6%93%9a%e5%b0%8d%e6%95%b8%e6%93%9a%e5%ba%ab%e7%9a%84%e5%bd%b1%e9%9f%bf-VkUOurcDZA\">\u5927\u6578\u64da\u5c0d\u6578\u64da\u5eab\u7684\u5f71\u97ff<\/h2>\n<p>\u5927\u6578\u64da\u7684\u8208\u8d77\u5c0d\u6578\u64da\u5eab\u6280\u8853\u5e36\u4f86\u4e86\u6df1\u9060\u7684\u5f71\u97ff\uff0c\u4e3b\u8981\u9ad4\u73fe\u5728\u4ee5\u4e0b\u5e7e\u500b\u65b9\u9762\uff1a<\/p>\n<h3 id=\"1-%e6%95%b8%e6%93%9a%e5%ba%ab%e6%9e%b6%e6%a7%8b%e7%9a%84%e8%ae%8a%e9%9d%a9-VkUOurcDZA\">1. \u6578\u64da\u5eab\u67b6\u69cb\u7684\u8b8a\u9769<\/h3>\n<p>\u50b3\u7d71\u7684\u95dc\u4fc2\u578b\u6578\u64da\u5eab\uff08\u5982MySQL\u3001PostgreSQL\uff09\u5728\u8655\u7406\u5927\u6578\u64da\u6642\u9762\u81e8\u6027\u80fd\u74f6\u9838\u3002\u56e0\u6b64\uff0c\u8a31\u591a\u4f01\u696d\u958b\u59cb\u8f49\u5411NoSQL\u6578\u64da\u5eab\uff08\u5982MongoDB\u3001Cassandra\uff09\uff0c\u9019\u4e9b\u6578\u64da\u5eab\u80fd\u5920\u66f4\u597d\u5730\u8655\u7406\u975e\u7d50\u69cb\u5316\u6578\u64da\u548c\u9ad8\u4e26\u767c\u8acb\u6c42\u3002<\/p>\n<pre><code>const MongoClient = require('mongodb').MongoClient;\nconst url = 'mongodb:\/\/localhost:27017';\n\nMongoClient.connect(url, function(err, db) {\n    if (err) throw err;\n    console.log(\"Database created!\");\n    db.close();\n});<\/code><\/pre>\n<h3 id=\"2-%e6%95%b8%e6%93%9a%e8%99%95%e7%90%86%e6%8a%80%e8%a1%93%e7%9a%84%e6%bc%94%e9%80%b2-VkUOurcDZA\">2. \u6578\u64da\u8655\u7406\u6280\u8853\u7684\u6f14\u9032<\/h3>\n<p>\u96a8\u8457\u5927\u6578\u64da\u6280\u8853\u7684\u767c\u5c55\uff0c\u6578\u64da\u8655\u7406\u6846\u67b6\u5982Hadoop\u548cSpark\u9010\u6f38\u6210\u70ba\u4e3b\u6d41\u3002\u9019\u4e9b\u6846\u67b6\u80fd\u5920\u8655\u7406\u6d77\u91cf\u6578\u64da\uff0c\u4e26\u63d0\u4f9b\u5206\u4f48\u5f0f\u8a08\u7b97\u80fd\u529b\uff0c\u5f9e\u800c\u63d0\u9ad8\u6578\u64da\u8655\u7406\u7684\u6548\u7387\u3002<\/p>\n<pre><code>val data = spark.read.textFile(\"hdfs:\/\/path\/to\/data.txt\")\ndata.filter(line =&gt; line.contains(\"\u91cd\u8981\u4fe1\u606f\")).count()<\/code><\/pre>\n<h3 id=\"3-%e6%95%b8%e6%93%9a%e5%88%86%e6%9e%90%e7%9a%84%e6%b7%b1%e5%8c%96-VkUOurcDZA\">3. \u6578\u64da\u5206\u6790\u7684\u6df1\u5316<\/h3>\n<p>\u5927\u6578\u64da\u7684\u61c9\u7528\u4f7f\u5f97\u6578\u64da\u5206\u6790\u8b8a\u5f97\u66f4\u52a0\u6df1\u5165\u548c\u7cbe\u7d30\u3002\u4f01\u696d\u53ef\u4ee5\u5229\u7528\u6578\u64da\u6316\u6398\u548c\u6a5f\u5668\u5b78\u7fd2\u6280\u8853\uff0c\u5f9e\u6d77\u91cf\u6578\u64da\u4e2d\u63d0\u53d6\u6709\u50f9\u503c\u7684\u4fe1\u606f\uff0c\u9032\u800c\u652f\u6301\u6c7a\u7b56\u5236\u5b9a\u3002<\/p>\n<h2 id=\"%e6%95%b8%e6%93%9a%e5%ba%ab%e6%87%89%e7%94%a8%e7%a8%8b%e5%ba%8f%e7%9a%84%e6%9c%80%e4%bd%b3%e5%af%a6%e8%b8%90-VkUOurcDZA\">\u6578\u64da\u5eab\u61c9\u7528\u7a0b\u5e8f\u7684\u6700\u4f73\u5be6\u8e10<\/h2>\n<p>\u5728\u5927\u6578\u64da\u74b0\u5883\u4e0b\uff0c\u958b\u767c\u6578\u64da\u5eab\u61c9\u7528\u7a0b\u5e8f\u6642\u61c9\u9075\u5faa\u4ee5\u4e0b\u6700\u4f73\u5be6\u8e10\uff1a<\/p>\n<ul>\n<li><strong>\u9078\u64c7\u5408\u9069\u7684\u6578\u64da\u5eab\u985e\u578b\uff1a<\/strong>\u6839\u64da\u6578\u64da\u7279\u6027\u548c\u696d\u52d9\u9700\u6c42\u9078\u64c7\u95dc\u4fc2\u578b\u6216NoSQL\u6578\u64da\u5eab\u3002<\/li>\n<li><strong>\u8a2d\u8a08\u9748\u6d3b\u7684\u6578\u64da\u6a21\u578b\uff1a<\/strong>\u8003\u616e\u5230\u6578\u64da\u7684\u591a\u6a23\u6027\uff0c\u8a2d\u8a08\u9748\u6d3b\u7684\u6578\u64da\u6a21\u578b\u4ee5\u9069\u61c9\u672a\u4f86\u7684\u8b8a\u5316\u3002<\/li>\n<li><strong>\u5be6\u65bd\u6578\u64da\u6cbb\u7406\uff1a<\/strong>\u78ba\u4fdd\u6578\u64da\u7684\u8cea\u91cf\u548c\u5b89\u5168\u6027\uff0c\u5efa\u7acb\u6578\u64da\u6cbb\u7406\u6846\u67b6\u3002<\/li>\n<li><strong>\u5229\u7528\u96f2\u6280\u8853\uff1a<\/strong>\u8003\u616e\u4f7f\u7528\u96f2\u6578\u64da\u5eab\u89e3\u6c7a\u65b9\u6848\uff0c\u4ee5\u4fbf\u65bc\u64f4\u5c55\u548c\u7ba1\u7406\u3002<\/li>\n<\/ul>\n<h2 id=\"%e7%b5%90%e8%ab%96-VkUOurcDZA\">\u7d50\u8ad6<\/h2>\n<p>\u5927\u6578\u64da\u7684\u6d6a\u6f6e\u70ba\u6578\u64da\u5eab\u61c9\u7528\u7a0b\u5e8f\u5e36\u4f86\u4e86\u65b0\u7684\u6311\u6230\u8207\u6a5f\u9047\u3002\u4f01\u696d\u9700\u8981\u4e0d\u65b7\u9069\u61c9\u9019\u4e00\u8b8a\u5316\uff0c\u9078\u64c7\u5408\u9069\u7684\u6280\u8853\u548c\u67b6\u69cb\uff0c\u4ee5\u4fbf\u5728\u6fc0\u70c8\u7684\u5e02\u5834\u7af6\u722d\u4e2d\u4fdd\u6301\u512a\u52e2\u3002\u96a8\u8457\u6280\u8853\u7684\u9032\u6b65\uff0c\u672a\u4f86\u7684\u6578\u64da\u5eab\u61c9\u7528\u7a0b\u5e8f\u5c07\u66f4\u52a0\u667a\u80fd\u5316\u548c\u81ea\u52d5\u5316\uff0c\u70ba\u4f01\u696d\u5275\u9020\u66f4\u5927\u7684\u50f9\u503c\u3002<\/p>\n<p>\u5982\u9700\u4e86\u89e3\u66f4\u591a\u95dc\u65bc <a href=\"https:\/\/server.hk\">\u9999\u6e2fVPS<\/a> \u548c\u6578\u64da\u5eab\u89e3\u6c7a\u65b9\u6848\u7684\u4fe1\u606f\uff0c\u8acb\u8a2a\u554f\u6211\u5011\u7684\u7db2\u7ad9\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u63a2\u7d22\u5927\u6578\u64da\u6d6a\u6f6e\u4e0b\u7684\u6578\u64da\u5eab\u61c9\u7528\u7a0b\u5e8f\uff0c\u4e86\u89e3\u5982\u4f55\u5229\u7528\u5927\u6578\u64da\u6280\u8853\u63d0\u5347\u6578\u64da\u7ba1\u7406\u8207\u5206\u6790\u6548\u7387\u3002<\/p>\n","protected":false},"author":0,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[101],"tags":[],"class_list":["post-153621","post","type-post","status-publish","format-standard","hentry","category-database"],"_links":{"self":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/153621","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/types\/post"}],"replies":[{"embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/comments?post=153621"}],"version-history":[{"count":1,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/153621\/revisions"}],"predecessor-version":[{"id":153622,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/153621\/revisions\/153622"}],"wp:attachment":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/media?parent=153621"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/categories?post=153621"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/tags?post=153621"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}