{"id":164825,"date":"2024-11-05T10:08:21","date_gmt":"2024-11-05T02:08:21","guid":{"rendered":"https:\/\/server.hk\/cnblog\/164825\/"},"modified":"2024-11-05T10:08:22","modified_gmt":"2024-11-05T02:08:22","slug":"%e9%96%8b%e5%95%9flinux-redis%e6%9c%8d%e5%8b%99%e8%87%aa%e5%95%9f%e5%8b%95%e5%8a%9f%e8%83%bd%ef%bc%88yum-redis%e8%87%aa%e5%95%9f%e5%8b%95%ef%bc%89","status":"publish","type":"post","link":"https:\/\/server.hk\/cnblog\/164825\/","title":{"rendered":"\u958b\u555fLinux Redis\u670d\u52d9\u81ea\u555f\u52d5\u529f\u80fd\uff08yum redis\u81ea\u555f\u52d5\uff09"},"content":{"rendered":"<h1 id=\"%e9%96%8b%e5%95%9flinux-redis%e6%9c%8d%e5%8b%99%e8%87%aa%e5%95%9f%e5%8b%95%e5%8a%9f%e8%83%bd%ef%bc%88yum-redis%e8%87%aa%e5%95%9f%e5%8b%95%ef%bc%89-wXvjBoYtGN\">\u958b\u555fLinux Redis\u670d\u52d9\u81ea\u555f\u52d5\u529f\u80fd\uff08yum redis\u81ea\u555f\u52d5\uff09<\/h1>\n<p>Redis\u662f\u4e00\u500b\u9ad8\u6548\u80fd\u7684\u9375\u503c\u5b58\u5132\u7cfb\u7d71\uff0c\u5ee3\u6cdb\u61c9\u7528\u65bc\u7de9\u5b58\u3001\u6d88\u606f\u968a\u5217\u548c\u6578\u64da\u6301\u4e45\u5316\u7b49\u5834\u666f\u3002\u5728Linux\u74b0\u5883\u4e2d\uff0c\u70ba\u4e86\u78ba\u4fddRedis\u670d\u52d9\u5728\u7cfb\u7d71\u91cd\u555f\u5f8c\u81ea\u52d5\u555f\u52d5\uff0c\u914d\u7f6e\u81ea\u555f\u52d5\u529f\u80fd\u662f\u975e\u5e38\u91cd\u8981\u7684\u3002\u672c\u6587\u5c07\u4ecb\u7d39\u5982\u4f55\u5728\u4f7f\u7528yum\u5b89\u88dd\u7684Redis\u4e0a\u8a2d\u7f6e\u81ea\u555f\u52d5\u529f\u80fd\u3002<\/p>\n<h2 id=\"%e5%ae%89%e8%a3%9dredis-wXvjBoYtGN\">\u5b89\u88ddRedis<\/h2>\n<p>\u9996\u5148\uff0c\u78ba\u4fdd\u4f60\u7684\u7cfb\u7d71\u5df2\u7d93\u5b89\u88dd\u4e86Redis\u3002\u53ef\u4ee5\u901a\u904e\u4ee5\u4e0b\u547d\u4ee4\u4f86\u5b89\u88ddRedis\uff1a<\/p>\n<pre><code>sudo yum install redis<\/code><\/pre>\n<p>\u5b89\u88dd\u5b8c\u6210\u5f8c\uff0c\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u555f\u52d5Redis\u670d\u52d9\uff1a<\/p>\n<pre><code>sudo systemctl start redis<\/code><\/pre>\n<p>\u8981\u6aa2\u67e5Redis\u670d\u52d9\u7684\u72c0\u614b\uff0c\u53ef\u4ee5\u4f7f\u7528\uff1a<\/p>\n<pre><code>sudo systemctl status redis<\/code><\/pre>\n<h2 id=\"%e8%a8%ad%e7%bd%aeredis%e8%87%aa%e5%95%9f%e5%8b%95-wXvjBoYtGN\">\u8a2d\u7f6eRedis\u81ea\u555f\u52d5<\/h2>\n<p>\u8981\u8a2d\u7f6eRedis\u670d\u52d9\u5728\u7cfb\u7d71\u555f\u52d5\u6642\u81ea\u52d5\u555f\u52d5\uff0c\u53ef\u4ee5\u4f7f\u7528systemctl\u547d\u4ee4\u3002\u57f7\u884c\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n<pre><code>sudo systemctl enable redis<\/code><\/pre>\n<p>\u9019\u689d\u547d\u4ee4\u6703\u5c07Redis\u670d\u52d9\u6dfb\u52a0\u5230\u7cfb\u7d71\u555f\u52d5\u9805\u4e2d\uff0c\u78ba\u4fdd\u5728\u6bcf\u6b21\u7cfb\u7d71\u91cd\u555f\u6642\u81ea\u52d5\u555f\u52d5\u3002<\/p>\n<h2 id=\"%e6%aa%a2%e6%9f%a5%e8%87%aa%e5%95%9f%e5%8b%95%e8%a8%ad%e7%bd%ae-wXvjBoYtGN\">\u6aa2\u67e5\u81ea\u555f\u52d5\u8a2d\u7f6e<\/h2>\n<p>\u70ba\u4e86\u78ba\u8a8dRedis\u670d\u52d9\u5df2\u6210\u529f\u8a2d\u7f6e\u70ba\u81ea\u555f\u52d5\uff0c\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u6aa2\u67e5\u670d\u52d9\u7684\u555f\u52d5\u72c0\u614b\uff1a<\/p>\n<pre><code>sudo systemctl is-enabled redis<\/code><\/pre>\n<p>\u5982\u679c\u8fd4\u56de\u7d50\u679c\u70ba\u201cenabled\u201d\uff0c\u5247\u8868\u793aRedis\u670d\u52d9\u5df2\u6210\u529f\u8a2d\u7f6e\u70ba\u81ea\u555f\u52d5\u3002<\/p>\n<h2 id=\"%e9%85%8d%e7%bd%aeredis-wXvjBoYtGN\">\u914d\u7f6eRedis<\/h2>\n<p>\u5728\u67d0\u4e9b\u60c5\u6cc1\u4e0b\uff0c\u60a8\u53ef\u80fd\u9700\u8981\u5c0dRedis\u7684\u914d\u7f6e\u6587\u4ef6\u9032\u884c\u8abf\u6574\u3002Redis\u7684\u914d\u7f6e\u6587\u4ef6\u901a\u5e38\u4f4d\u65bc\uff1a<\/p>\n<pre><code>\/etc\/redis.conf<\/code><\/pre>\n<p>\u60a8\u53ef\u4ee5\u4f7f\u7528\u6587\u672c\u7de8\u8f2f\u5668\uff08\u5982vi\u6216nano\uff09\u4f86\u7de8\u8f2f\u6b64\u6587\u4ef6\uff1a<\/p>\n<pre><code>sudo vi \/etc\/redis.conf<\/code><\/pre>\n<p>\u5728\u914d\u7f6e\u6587\u4ef6\u4e2d\uff0c\u60a8\u53ef\u4ee5\u8a2d\u7f6e\u5404\u7a2e\u53c3\u6578\uff0c\u4f8b\u5982\u6700\u5927\u5167\u5b58\u4f7f\u7528\u91cf\u3001\u6301\u4e45\u5316\u9078\u9805\u7b49\u3002\u4fee\u6539\u5b8c\u6210\u5f8c\uff0c\u8a18\u5f97\u91cd\u555fRedis\u670d\u52d9\u4ee5\u4f7f\u66f4\u6539\u751f\u6548\uff1a<\/p>\n<pre><code>sudo systemctl restart redis<\/code><\/pre>\n<h2 id=\"%e6%b8%ac%e8%a9%a6%e8%87%aa%e5%95%9f%e5%8b%95%e5%8a%9f%e8%83%bd-wXvjBoYtGN\">\u6e2c\u8a66\u81ea\u555f\u52d5\u529f\u80fd<\/h2>\n<p>\u70ba\u4e86\u78ba\u4fdd\u81ea\u555f\u52d5\u529f\u80fd\u6b63\u5e38\u904b\u4f5c\uff0c\u53ef\u4ee5\u91cd\u555f\u7cfb\u7d71\u4e26\u6aa2\u67e5Redis\u670d\u52d9\u7684\u72c0\u614b\uff1a<\/p>\n<pre><code>sudo reboot<\/code><\/pre>\n<p>\u7cfb\u7d71\u91cd\u555f\u5f8c\uff0c\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u6aa2\u67e5Redis\u670d\u52d9\u662f\u5426\u6b63\u5728\u904b\u884c\uff1a<\/p>\n<pre><code>sudo systemctl status redis<\/code><\/pre>\n<p>\u5982\u679c\u670d\u52d9\u72c0\u614b\u986f\u793a\u70ba\u201cactive (running)\u201d\uff0c\u5247\u8868\u793a\u81ea\u555f\u52d5\u529f\u80fd\u5df2\u6210\u529f\u914d\u7f6e\u3002<\/p>\n<h2 id=\"%e7%b8%bd%e7%b5%90-wXvjBoYtGN\">\u7e3d\u7d50<\/h2>\n<p>\u5728Linux\u7cfb\u7d71\u4e2d\uff0c\u70baRedis\u670d\u52d9\u8a2d\u7f6e\u81ea\u555f\u52d5\u529f\u80fd\u662f\u4e00\u500b\u7c21\u55ae\u800c\u91cd\u8981\u7684\u6b65\u9a5f\u3002\u901a\u904e\u4f7f\u7528systemctl\u547d\u4ee4\uff0c\u60a8\u53ef\u4ee5\u8f15\u9b06\u5730\u78ba\u4fddRedis\u5728\u7cfb\u7d71\u91cd\u555f\u5f8c\u81ea\u52d5\u555f\u52d5\uff0c\u5f9e\u800c\u63d0\u9ad8\u7cfb\u7d71\u7684\u7a69\u5b9a\u6027\u548c\u53ef\u7528\u6027\u3002\u5982\u679c\u60a8\u9700\u8981\u9ad8\u6548\u7684 <a href=\"https:\/\/server.hk\">VPS<\/a> \u89e3\u6c7a\u65b9\u6848\u4f86\u904b\u884cRedis\uff0c\u8acb\u8003\u616e\u6211\u5011\u7684\u670d\u52d9\uff0c\u63d0\u4f9b\u7a69\u5b9a\u7684\u6027\u80fd\u548c\u9748\u6d3b\u7684\u914d\u7f6e\u9078\u9805\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5b78\u7fd2\u5982\u4f55\u5728Linux\u4e0a\u555f\u7528Redis\u670d\u52d9\u81ea\u555f\u52d5\u529f\u80fd\uff0c\u4f7f\u7528yum\u5b89\u88dd\u4e26\u914d\u7f6eRedis\u4ee5\u5be6\u73fe\u81ea\u52d5\u555f\u52d5\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-164825","post","type-post","status-publish","format-standard","hentry","category-database"],"_links":{"self":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/164825","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=164825"}],"version-history":[{"count":1,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/164825\/revisions"}],"predecessor-version":[{"id":164826,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/164825\/revisions\/164826"}],"wp:attachment":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/media?parent=164825"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/categories?post=164825"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/tags?post=164825"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}