{"id":43762,"date":"2024-10-06T09:11:43","date_gmt":"2024-10-06T01:11:43","guid":{"rendered":"https:\/\/server.hk\/cnblog\/43762\/"},"modified":"2024-10-06T09:11:43","modified_gmt":"2024-10-06T01:11:43","slug":"centos-7-%e5%ae%89%e8%a3%9d-elastic-stack","status":"publish","type":"post","link":"https:\/\/server.hk\/cnblog\/43762\/","title":{"rendered":"CentOS 7 \u5b89\u88dd Elastic Stack"},"content":{"rendered":"<h1 id=\"centos-7-%e5%ae%89%e8%a3%9d-elastic-stack-tqnUqaMMGG\">CentOS 7 \u5b89\u88dd Elastic Stack<\/h1>\n<p>Elastic Stack\uff08\u4ee5\u524d\u7a31\u70ba ELK Stack\uff09\u662f\u4e00\u500b\u5f37\u5927\u7684\u958b\u6e90\u5de5\u5177\u96c6\uff0c\u4e3b\u8981\u7528\u65bc\u641c\u7d22\u3001\u5206\u6790\u548c\u53ef\u8996\u5316\u6578\u64da\u3002\u5b83\u7531 Elasticsearch\u3001Logstash\u3001Kibana \u548c Beats \u7d44\u6210\uff0c\u5ee3\u6cdb\u61c9\u7528\u65bc\u65e5\u8a8c\u7ba1\u7406\u3001\u6578\u64da\u5206\u6790\u548c\u76e3\u63a7\u7b49\u5834\u666f\u3002\u672c\u6587\u5c07\u4ecb\u7d39\u5982\u4f55\u5728 CentOS 7 \u4e0a\u5b89\u88dd Elastic Stack\u3002<\/p>\n<h2 id=\"%e5%89%8d%e6%9c%9f%e6%ba%96%e5%82%99-tqnUqaMMGG\">\u524d\u671f\u6e96\u5099<\/h2>\n<p>\u5728\u958b\u59cb\u5b89\u88dd\u4e4b\u524d\uff0c\u8acb\u78ba\u4fdd\u60a8\u7684 CentOS 7 \u7cfb\u7d71\u5df2\u7d93\u66f4\u65b0\u5230\u6700\u65b0\u7248\u672c\u3002\u60a8\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u9032\u884c\u66f4\u65b0\uff1a<\/p>\n<pre><code>sudo yum update -y<\/code><\/pre>\n<p>\u6b64\u5916\uff0c\u60a8\u9700\u8981\u5b89\u88dd\u4e00\u4e9b\u5fc5\u8981\u7684\u4f9d\u8cf4\u5305\uff1a<\/p>\n<pre><code>sudo yum install -y wget curl<\/code><\/pre>\n<h2 id=\"%e5%ae%89%e8%a3%9d-elasticsearch-tqnUqaMMGG\">\u5b89\u88dd Elasticsearch<\/h2>\n<p>\u9996\u5148\uff0c\u6211\u5011\u9700\u8981\u5b89\u88dd Elasticsearch\u3002\u53ef\u4ee5\u901a\u904e\u4ee5\u4e0b\u6b65\u9a5f\u9032\u884c\u5b89\u88dd\uff1a<\/p>\n<ol>\n<li>\u5c0e\u5165 Elasticsearch \u7684 GPG \u5bc6\u9470\uff1a<\/li>\n<pre><code>sudo rpm --import https:\/\/artifacts.elastic.co\/GPG-KEY-elasticsearch<\/code><\/pre>\n<li>\u5275\u5efa Elasticsearch \u7684 YUM \u5b58\u5132\u5eab\u6587\u4ef6\uff1a<\/li>\n<pre><code>sudo vi \/etc\/yum.repos.d\/elasticsearch.repo<\/code><\/pre>\n<p>\u5728\u6587\u4ef6\u4e2d\u6dfb\u52a0\u4ee5\u4e0b\u5167\u5bb9\uff1a<\/p>\n<pre><code>[elasticsearch-7.x]\nname=Elasticsearch repository for 7.x packages\nbaseurl=https:\/\/artifacts.elastic.co\/packages\/7.x\/yum\ngpgcheck=1\ngpgkey=https:\/\/artifacts.elastic.co\/GPG-KEY-elasticsearch\nenabled=1\nautorefresh=1\ntype=rpm-md<\/code><\/pre>\n<li>\u5b89\u88dd Elasticsearch\uff1a<\/li>\n<pre><code>sudo yum install elasticsearch -y<\/code><\/pre>\n<li>\u555f\u52d5 Elasticsearch \u4e26\u8a2d\u7f6e\u70ba\u958b\u6a5f\u81ea\u555f\uff1a<\/li>\n<pre><code>sudo systemctl start elasticsearch\nsudo systemctl enable elasticsearch<\/code><\/pre>\n<li>\u6aa2\u67e5 Elasticsearch \u662f\u5426\u6b63\u5e38\u904b\u884c\uff1a<\/li>\n<pre><code>curl -X GET \"localhost:9200\/\"<\/code><\/pre>\n<\/ol>\n<h2 id=\"%e5%ae%89%e8%a3%9d-logstash-tqnUqaMMGG\">\u5b89\u88dd Logstash<\/h2>\n<p>\u63a5\u4e0b\u4f86\uff0c\u6211\u5011\u5c07\u5b89\u88dd Logstash\u3002\u8acb\u6309\u7167\u4ee5\u4e0b\u6b65\u9a5f\u9032\u884c\uff1a<\/p>\n<ol>\n<li>\u5b89\u88dd Logstash\uff1a<\/li>\n<pre><code>sudo yum install logstash -y<\/code><\/pre>\n<li>\u5275\u5efa\u4e00\u500b\u7c21\u55ae\u7684\u914d\u7f6e\u6587\u4ef6\u4ee5\u6e2c\u8a66 Logstash\uff1a<\/li>\n<pre><code>sudo vi \/etc\/logstash\/conf.d\/test.conf<\/code><\/pre>\n<p>\u5728\u6587\u4ef6\u4e2d\u6dfb\u52a0\u4ee5\u4e0b\u5167\u5bb9\uff1a<\/p>\n<pre><code>input {\n  stdin { }\n}\n\noutput {\n  elasticsearch { \n    hosts =&gt; [\"localhost:9200\"]\n  }\n}<\/code><\/pre>\n<li>\u555f\u52d5 Logstash\uff1a<\/li>\n<pre><code>sudo systemctl start logstash<\/code><\/pre>\n<\/ol>\n<h2 id=\"%e5%ae%89%e8%a3%9d-kibana-tqnUqaMMGG\">\u5b89\u88dd Kibana<\/h2>\n<p>\u6700\u5f8c\uff0c\u6211\u5011\u5c07\u5b89\u88dd Kibana\u3002\u8acb\u6309\u7167\u4ee5\u4e0b\u6b65\u9a5f\u9032\u884c\uff1a<\/p>\n<ol>\n<li>\u5b89\u88dd Kibana\uff1a<\/li>\n<pre><code>sudo yum install kibana -y<\/code><\/pre>\n<li>\u555f\u52d5 Kibana \u4e26\u8a2d\u7f6e\u70ba\u958b\u6a5f\u81ea\u555f\uff1a<\/li>\n<pre><code>sudo systemctl start kibana\nsudo systemctl enable kibana<\/code><\/pre>\n<li>\u5728\u700f\u89bd\u5668\u4e2d\u8a2a\u554f Kibana\uff1a<\/li>\n<p>\u6253\u958b\u700f\u89bd\u5668\u4e26\u8a2a\u554f <a href=\"http:\/\/localhost:5601\" rel=\"nofollow noopener\" target=\"_blank\">http:\/\/localhost:5601<\/a>\uff0c\u60a8\u61c9\u8a72\u80fd\u5920\u770b\u5230 Kibana \u7684\u754c\u9762\u3002<\/p>\n<\/ol>\n<h2 id=\"%e7%b8%bd%e7%b5%90-tqnUqaMMGG\">\u7e3d\u7d50<\/h2>\n<p>\u901a\u904e\u4ee5\u4e0a\u6b65\u9a5f\uff0c\u60a8\u5df2\u7d93\u6210\u529f\u5728 CentOS 7 \u4e0a\u5b89\u88dd\u4e86 Elastic Stack\u3002\u9019\u4e00\u5de5\u5177\u96c6\u80fd\u5920\u5e6b\u52a9\u60a8\u66f4\u597d\u5730\u7ba1\u7406\u548c\u5206\u6790\u6578\u64da\u3002\u5982\u679c\u60a8\u9700\u8981\u7a69\u5b9a\u7684 <a href=\"https:\/\/server.hk\">VPS<\/a> \u4f86\u904b\u884c Elastic Stack\uff0cServer.HK \u63d0\u4f9b\u591a\u7a2e\u9078\u64c7\uff0c\u9069\u5408\u4e0d\u540c\u9700\u6c42\u7684\u7528\u6236\u3002\u7121\u8ad6\u662f <a href=\"https:\/\/server.hk\">\u9999\u6e2f\u4f3a\u670d\u5668<\/a> \u9084\u662f\u5176\u4ed6\u5730\u5340\u7684\u670d\u52d9\uff0c\u60a8\u90fd\u53ef\u4ee5\u627e\u5230\u5408\u9069\u7684\u89e3\u6c7a\u65b9\u6848\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Learn how to install Elastic Stack on CentOS 7 with step-by-step instructions for setting up Elasticsearch, Logstash, and Kibana efficiently.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4924],"tags":[],"class_list":["post-43762","post","type-post","status-publish","format-standard","hentry","category-setup-tutorials"],"_links":{"self":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/43762","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"}],"author":[{"embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/comments?post=43762"}],"version-history":[{"count":1,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/43762\/revisions"}],"predecessor-version":[{"id":43763,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/43762\/revisions\/43763"}],"wp:attachment":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/media?parent=43762"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/categories?post=43762"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/tags?post=43762"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}