{"id":163155,"date":"2024-11-04T21:07:23","date_gmt":"2024-11-04T13:07:23","guid":{"rendered":"https:\/\/server.hk\/cnblog\/163155\/"},"modified":"2024-11-04T21:07:24","modified_gmt":"2024-11-04T13:07:24","slug":"%e8%a7%a3%e8%ae%80nosql%e6%95%b8%e6%93%9a%e5%ba%ab%e7%9a%84%e5%9b%9b%e5%a4%a7%e5%ae%b6%e6%97%8f","status":"publish","type":"post","link":"https:\/\/server.hk\/cnblog\/163155\/","title":{"rendered":"\u89e3\u8b80NoSQL\u6578\u64da\u5eab\u7684\u56db\u5927\u5bb6\u65cf"},"content":{"rendered":"<h1 id=\"%e8%a7%a3%e8%ae%80nosql%e6%95%b8%e6%93%9a%e5%ba%ab%e7%9a%84%e5%9b%9b%e5%a4%a7%e5%ae%b6%e6%97%8f-BlzAMyjOSj\">\u89e3\u8b80NoSQL\u6578\u64da\u5eab\u7684\u56db\u5927\u5bb6\u65cf<\/h1>\n<p>NoSQL\u6578\u64da\u5eab\u5728\u8fd1\u5e74\u4f86\u56e0\u5176\u9748\u6d3b\u6027\u548c\u53ef\u64f4\u5c55\u6027\u800c\u53d7\u5230\u5ee3\u6cdb\u95dc\u6ce8\u3002\u8207\u50b3\u7d71\u7684\u95dc\u4fc2\u578b\u6578\u64da\u5eab\u76f8\u6bd4\uff0cNoSQL\u6578\u64da\u5eab\u80fd\u5920\u66f4\u597d\u5730\u8655\u7406\u5927\u6578\u64da\u548c\u975e\u7d50\u69cb\u5316\u6578\u64da\u3002\u672c\u6587\u5c07\u6df1\u5165\u63a2\u8a0eNoSQL\u6578\u64da\u5eab\u7684\u56db\u5927\u5bb6\u65cf\uff0c\u5e6b\u52a9\u8b80\u8005\u66f4\u597d\u5730\u7406\u89e3\u5176\u7279\u9ede\u548c\u61c9\u7528\u5834\u666f\u3002<\/p>\n<h2 id=\"1-%e9%8d%b5%e5%80%bc%e5%ad%98%e5%84%b2%ef%bc%88key-value-stores%ef%bc%89-BlzAMyjOSj\">1. \u9375\u503c\u5b58\u5132\uff08Key-Value Stores\uff09<\/h2>\n<p>\u9375\u503c\u5b58\u5132\u662fNoSQL\u6578\u64da\u5eab\u4e2d\u6700\u7c21\u55ae\u7684\u4e00\u7a2e\u5f62\u5f0f\u3002\u5b83\u4ee5\u9375\uff08Key\uff09\u548c\u503c\uff08Value\uff09\u5c0d\u7684\u5f62\u5f0f\u5b58\u5132\u6578\u64da\uff0c\u9069\u5408\u7528\u65bc\u9700\u8981\u5feb\u901f\u67e5\u8a62\u7684\u5834\u666f\u3002\u5e38\u898b\u7684\u9375\u503c\u5b58\u5132\u7cfb\u7d71\u5305\u62ecRedis\u548cAmazon DynamoDB\u3002<\/p>\n<pre><code>\n# Redis\u793a\u4f8b\nSET user:1000 \"John Doe\"\nGET user:1000\n<\/code><\/pre>\n<p>\u9375\u503c\u5b58\u5132\u7684\u512a\u52e2\u5728\u65bc\u5176\u9ad8\u6548\u7684\u67e5\u8a62\u6027\u80fd\u548c\u7c21\u55ae\u7684\u6578\u64da\u6a21\u578b\uff0c\u4f46\u7f3a\u9ede\u662f\u7f3a\u4e4f\u8907\u96dc\u67e5\u8a62\u7684\u80fd\u529b\uff0c\u5c0d\u65bc\u9700\u8981\u95dc\u806f\u67e5\u8a62\u7684\u61c9\u7528\u5834\u666f\u4e0d\u592a\u9069\u5408\u3002<\/p>\n<h2 id=\"2-%e6%96%87%e6%aa%94%e5%ad%98%e5%84%b2%ef%bc%88document-stores%ef%bc%89-BlzAMyjOSj\">2. \u6587\u6a94\u5b58\u5132\uff08Document Stores\uff09<\/h2>\n<p>\u6587\u6a94\u5b58\u5132\u6578\u64da\u5eab\u4ee5\u6587\u6a94\u7684\u5f62\u5f0f\u5b58\u5132\u6578\u64da\uff0c\u901a\u5e38\u4f7f\u7528JSON\u6216BSON\u683c\u5f0f\u3002\u9019\u7a2e\u6578\u64da\u5eab\u9069\u5408\u5b58\u5132\u7d50\u69cb\u5316\u548c\u534a\u7d50\u69cb\u5316\u6578\u64da\uff0c\u4e26\u4e14\u652f\u6301\u8907\u96dc\u7684\u67e5\u8a62\u3002MongoDB\u548cCouchDB\u662f\u6700\u8457\u540d\u7684\u6587\u6a94\u5b58\u5132\u7cfb\u7d71\u3002<\/p>\n<pre><code>\n# MongoDB\u793a\u4f8b\ndb.users.insert({ \"name\": \"John Doe\", \"age\": 30 })\ndb.users.find({ \"name\": \"John Doe\" })\n<\/code><\/pre>\n<p>\u6587\u6a94\u5b58\u5132\u7684\u512a\u52e2\u5728\u65bc\u5176\u9748\u6d3b\u6027\u548c\u53ef\u64f4\u5c55\u6027\uff0c\u80fd\u5920\u8f15\u9b06\u5730\u8655\u7406\u8b8a\u5316\u7684\u6578\u64da\u7d50\u69cb\u3002\u7136\u800c\uff0c\u5c0d\u65bc\u9700\u8981\u5f37\u4e00\u81f4\u6027\u7684\u61c9\u7528\uff0c\u6587\u6a94\u5b58\u5132\u53ef\u80fd\u6703\u9762\u81e8\u6311\u6230\u3002<\/p>\n<h2 id=\"3-%e5%88%97%e6%97%8f%e5%ad%98%e5%84%b2%ef%bc%88column-family-stores%ef%bc%89-BlzAMyjOSj\">3. \u5217\u65cf\u5b58\u5132\uff08Column-Family Stores\uff09<\/h2>\n<p>\u5217\u65cf\u5b58\u5132\u6578\u64da\u5eab\u4ee5\u5217\u70ba\u55ae\u4f4d\u5b58\u5132\u6578\u64da\uff0c\u9069\u5408\u8655\u7406\u5927\u898f\u6a21\u7684\u6578\u64da\u96c6\u3002\u9019\u7a2e\u6578\u64da\u5eab\u7684\u8a2d\u8a08\u4f7f\u5f97\u5b83\u80fd\u5920\u9ad8\u6548\u5730\u9032\u884c\u8b80\u53d6\u548c\u5beb\u5165\u64cd\u4f5c\u3002Apache Cassandra\u548cHBase\u662f\u5169\u500b\u8457\u540d\u7684\u5217\u65cf\u5b58\u5132\u7cfb\u7d71\u3002<\/p>\n<pre><code>\n# Cassandra\u793a\u4f8b\nCREATE TABLE users (user_id UUID PRIMARY KEY, name TEXT, age INT);\nINSERT INTO users (user_id, name, age) VALUES (uuid(), 'John Doe', 30);\n<\/code><\/pre>\n<p>\u5217\u65cf\u5b58\u5132\u7684\u512a\u52e2\u5728\u65bc\u5176\u9ad8\u53ef\u7528\u6027\u548c\u53ef\u64f4\u5c55\u6027\uff0c\u7279\u5225\u9069\u5408\u9700\u8981\u8655\u7406\u5927\u91cf\u5beb\u5165\u64cd\u4f5c\u7684\u61c9\u7528\u3002\u7136\u800c\uff0c\u9019\u985e\u6578\u64da\u5eab\u7684\u67e5\u8a62\u80fd\u529b\u76f8\u5c0d\u8f03\u5f31\uff0c\u5c0d\u65bc\u8907\u96dc\u67e5\u8a62\u7684\u652f\u6301\u6709\u9650\u3002<\/p>\n<h2 id=\"4-%e5%9c%96%e5%bd%a2%e6%95%b8%e6%93%9a%e5%ba%ab%ef%bc%88graph-databases%ef%bc%89-BlzAMyjOSj\">4. \u5716\u5f62\u6578\u64da\u5eab\uff08Graph Databases\uff09<\/h2>\n<p>\u5716\u5f62\u6578\u64da\u5eab\u5c08\u6ce8\u65bc\u5b58\u5132\u548c\u67e5\u8a62\u5716\u5f62\u7d50\u69cb\u7684\u6578\u64da\uff0c\u7279\u5225\u9069\u5408\u8655\u7406\u8907\u96dc\u7684\u95dc\u806f\u6578\u64da\u3002Neo4j\u548cAmazon Neptune\u662f\u5e38\u898b\u7684\u5716\u5f62\u6578\u64da\u5eab\u3002\u9019\u985e\u6578\u64da\u5eab\u4f7f\u7528\u7bc0\u9ede\u3001\u908a\u548c\u5c6c\u6027\u4f86\u8868\u793a\u6578\u64da\u53ca\u5176\u95dc\u4fc2\u3002<\/p>\n<pre><code>\n# Neo4j\u793a\u4f8b\nCREATE (a:Person {name: 'John Doe', age: 30})\nCREATE (b:Person {name: 'Jane Doe', age: 25})\nCREATE (a)-[:KNOWS]-&gt;(b)\n<\/code><\/pre>\n<p>\u5716\u5f62\u6578\u64da\u5eab\u7684\u512a\u52e2\u5728\u65bc\u5176\u5f37\u5927\u7684\u95dc\u806f\u67e5\u8a62\u80fd\u529b\uff0c\u80fd\u5920\u9ad8\u6548\u5730\u8655\u7406\u793e\u4ea4\u7db2\u7d61\u3001\u63a8\u85a6\u7cfb\u7d71\u7b49\u61c9\u7528\u5834\u666f\u3002\u7136\u800c\uff0c\u9019\u985e\u6578\u64da\u5eab\u7684\u5b78\u7fd2\u66f2\u7dda\u76f8\u5c0d\u8f03\u9661\uff0c\u5c0d\u65bc\u65b0\u624b\u4f86\u8aaa\u53ef\u80fd\u9700\u8981\u4e00\u5b9a\u7684\u6642\u9593\u4f86\u9069\u61c9\u3002<\/p>\n<h2 id=\"%e7%b8%bd%e7%b5%90-BlzAMyjOSj\">\u7e3d\u7d50<\/h2>\n<p>NoSQL\u6578\u64da\u5eab\u7684\u56db\u5927\u5bb6\u65cf\u5404\u5177\u7279\u9ede\uff0c\u9069\u7528\u65bc\u4e0d\u540c\u7684\u61c9\u7528\u5834\u666f\u3002\u9375\u503c\u5b58\u5132\u9069\u5408\u5feb\u901f\u67e5\u8a62\uff0c\u6587\u6a94\u5b58\u5132\u63d0\u4f9b\u9748\u6d3b\u6027\uff0c\u5217\u65cf\u5b58\u5132\u9069\u5408\u5927\u898f\u6a21\u6578\u64da\u8655\u7406\uff0c\u800c\u5716\u5f62\u6578\u64da\u5eab\u5247\u5c08\u6ce8\u65bc\u8907\u96dc\u7684\u95dc\u806f\u67e5\u8a62\u3002\u9078\u64c7\u5408\u9069\u7684NoSQL\u6578\u64da\u5eab\u53ef\u4ee5\u5e6b\u52a9\u4f01\u696d\u66f4\u597d\u5730\u7ba1\u7406\u548c\u5229\u7528\u6578\u64da\u3002<\/p>\n<p>\u5982\u679c\u60a8\u5c0d\u65bc\u5982\u4f55\u5728\u9999\u6e2f\u9078\u64c7\u5408\u9069\u7684 <a href=\"https:\/\/server.hk\">VPS<\/a> \u89e3\u6c7a\u65b9\u6848\u6709\u8208\u8da3\uff0c\u6216\u60f3\u4e86\u89e3\u66f4\u591a\u95dc\u65bc <a href=\"https:\/\/server.hk\">\u9999\u6e2f\u4f3a\u670d\u5668<\/a> \u7684\u8cc7\u8a0a\uff0c\u6b61\u8fce\u8a2a\u554f\u6211\u5011\u7684\u7db2\u7ad9\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u63a2\u7d22NoSQL\u6578\u64da\u5eab\u7684\u56db\u5927\u5bb6\u65cf\uff1a\u9375\u503c\u5b58\u5132\u3001\u6587\u6a94\u5b58\u5132\u3001\u5217\u65cf\u5b58\u5132\u548c\u5716\u5f62\u6578\u64da\u5eab\uff0c\u4e86\u89e3\u5404\u81ea\u7279\u9ede\u8207\u61c9\u7528\u5834\u666f\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-163155","post","type-post","status-publish","format-standard","hentry","category-database"],"_links":{"self":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/163155","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=163155"}],"version-history":[{"count":1,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/163155\/revisions"}],"predecessor-version":[{"id":163156,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/163155\/revisions\/163156"}],"wp:attachment":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/media?parent=163155"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/categories?post=163155"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/tags?post=163155"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}