{"id":63676,"date":"2023-07-20T13:51:18","date_gmt":"2023-07-20T05:51:18","guid":{"rendered":"http:\/\/lrxjmw.cn\/?p=63676"},"modified":"2023-07-20T13:51:18","modified_gmt":"2023-07-20T05:51:18","slug":"elastic-stack-conf-install","status":"publish","type":"post","link":"https:\/\/lrxjmw.cn\/elastic-stack-conf-install.html","title":{"rendered":"Centos7\u4e0a\u5b89\u88c5\u4e0e\u914d\u7f6eElastic Stack"},"content":{"rendered":"
\u5bfc\u8bfb<\/td>\n | Elasticsearch\u662f\u57fa\u4e8e Lucene \u7531 Java \u5f00\u53d1\u7684\u5f00\u6e90\u641c\u7d22\u5f15\u64ce\uff0c\u662f\u7528\u4e8e\u7ba1\u7406\u4e8b\u4ef6\u548c\u65e5\u5fd7\u7684\u5f00\u6e90\u5de5\u5177\uff0cLogstash \u5c06\u6536\u96c6\u60a8\u7684\u65e5\u5fd7\u6570\u636e\uff0c\u5c06\u6570\u636e\u8f6c\u6362\u4e3a JSON \u6587\u6863\uff0c\u5e76\u5c06\u5176\u5b58\u50a8\u5728 Elasticsearch \u4e2d\u3002\u5728\u672c\u6559\u7a0b\u4e2d\uff0c\u6211\u5c06\u5411\u60a8\u5c55\u793a\u5982\u4f55\u5728 CentOS 7 \u670d\u52a1\u5668\u4e0a\u5b89\u88c5\u548c\u914d\u7f6e Elastic Stack \u4ee5\u76d1\u89c6\u670d\u52a1\u5668\u65e5\u5fd7\u3002 \u7136\u540e\uff0c\u6211\u5c06\u5411\u60a8\u5c55\u793a\u5982\u4f55\u5728\u64cd\u4f5c\u7cfb\u7edf\u4e3a CentOS 7 \u548c Ubuntu 16 \u7684\u5ba2\u6237\u7aef\u4e0a\u5b89\u88c5 \u201cElastic beats\u201d\u3002<\/strong><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n Elastic Stack\u7b80\u4ecb<\/strong><\/div>\n \u5de5\u5177\u540d\u79f0\u4ecb\u7ecd<\/strong><\/span><\/div>\n Elasticsearch<\/span>\u662f\u57fa\u4e8e Lucene \u7531 Java \u5f00\u53d1\u7684\u5f00\u6e90\u641c\u7d22\u5f15\u64ce\u3002\u5b83\u63d0\u4f9b\u4e86\u4e00\u4e2a\u5206\u5e03\u5f0f\u3001\u591a\u79df\u6237\u7684\u5168\u6587\u641c\u7d22\u5f15\u64ce\uff08\u591a\u79df\u6237\u662f\u6307\u591a\u79df\u6237\u6280\u672f\uff0c\u662f\u4e00\u79cd\u8f6f\u4ef6\u67b6\u6784\u6280\u672f\uff0c\u7528\u6765\u63a2\u8ba8\u4e0e\u5b9e\u73b0\u5982\u4f55\u5728\u591a\u7528\u6237\u7684\u73af\u5883\u4e0b\u5171\u7528\u76f8\u540c\u7684\u7cfb\u7edf\u6216\u7a0b\u5e8f\u7ec4\u4ef6\uff0c\u5e76\u4e14\u4ecd\u53ef\u786e\u4fdd\u5404\u7528\u6237\u95f4\u6570\u636e\u7684\u9694\u79bb\u6027\u3002\uff09\uff0c\u5e76\u5e26\u6709 HTTP \u4eea\u8868\u76d8\u7684 Web \u754c\u9762\uff08Kibana\uff09\u3002\u6570\u636e\u4f1a\u88ab Elasticsearch \u67e5\u8be2\u3001\u68c0\u7d22\uff0c\u5e76\u4e14\u4f7f\u7528 JSON \u6587\u6863\u65b9\u6848\u5b58\u50a8\u3002Elasticsearch \u662f\u4e00\u4e2a\u53ef\u6269\u5c55\u7684\u641c\u7d22\u5f15\u64ce\uff0c\u53ef\u7528\u4e8e\u641c\u7d22\u6240\u6709\u7c7b\u578b\u7684\u6587\u672c\u6587\u6863\uff0c\u5305\u62ec\u65e5\u5fd7\u6587\u4ef6\u3002Elasticsearch \u662f Elastic Stack \u7684\u6838\u5fc3\uff0cElastic Stack \u4e5f\u88ab\u79f0\u4e3a ELK Stack\u3002<\/p>\n Logstash<\/span>\u662f\u7528\u4e8e\u7ba1\u7406\u4e8b\u4ef6\u548c\u65e5\u5fd7\u7684\u5f00\u6e90\u5de5\u5177\u3002\u5b83\u4e3a\u6570\u636e\u6536\u96c6\u63d0\u4f9b\u5b9e\u65f6\u4f20\u9012\u9014\u5f84\u3002 Logstash \u5c06\u6536\u96c6\u60a8\u7684\u65e5\u5fd7\u6570\u636e\uff0c\u5c06\u6570\u636e\u8f6c\u6362\u4e3a JSON \u6587\u6863\uff0c\u5e76\u5c06\u5176\u5b58\u50a8\u5728 Elasticsearch \u4e2d\u3002<\/p>\n Kibana<\/span>\u662f Elasticsearch \u7684\u5f00\u6e90\u6570\u636e\u53ef\u89c6\u5316\u5de5\u5177\u3002Kibana \u63d0\u4f9b\u4e86\u4e00\u4e2a\u6f02\u4eae\u7684\u4eea\u8868\u76d8 Web \u754c\u9762\u3002 \u4f60\u53ef\u4ee5\u7528\u5b83\u6765\u7ba1\u7406\u548c\u53ef\u89c6\u5316\u6765\u81ea Elasticsearch \u7684\u6570\u636e\u3002 \u5b83\u4e0d\u4ec5\u7f8e\u4e3d\uff0c\u800c\u4e14\u5f3a\u5927\u3002<\/p>\n \u5728\u672c\u6559\u7a0b\u4e2d\uff0c\u6211\u5c06\u5411\u60a8\u5c55\u793a\u5982\u4f55\u5728 CentOS 7 \u670d\u52a1\u5668\u4e0a\u5b89\u88c5\u548c\u914d\u7f6e Elastic Stack \u4ee5\u76d1\u89c6\u670d\u52a1\u5668\u65e5\u5fd7\u3002 \u7136\u540e\uff0c\u6211\u5c06\u5411\u60a8\u5c55\u793a\u5982\u4f55\u5728\u64cd\u4f5c\u7cfb\u7edf\u4e3a CentOS 7 \u548c Ubuntu 16 \u7684\u5ba2\u6237\u7aef\u4e0a\u5b89\u88c5 \u201cElastic beats\u201d\u3002<\/p>\n \u6211\u4eec\u5c06\u7981\u7528 CentOS 7 \u670d\u52a1\u5668\u4e0a\u7684 SELinux\u3002 \u7f16\u8f91 SELinux \u914d\u7f6e\u6587\u4ef6\u3002<\/p>\n \u90e8\u7f72 Elastic stack \u4f9d\u8d56\u4e8eJava\uff0cElasticsearch \u9700\u8981 Java 8 \u7248\u672c\uff0c\u63a8\u8350\u4f7f\u7528 Oracle JDK 1.8 \u3002\u4ece\u5b98\u65b9\u7684 Oracle rpm \u5305\u5b89\u88c5 Java 8\u3002<\/p>\n \u5728\u6b64\u6b65\u9aa4\u4e2d\uff0c\u6211\u4eec\u5c06\u5b89\u88c5\u548c\u914d\u7f6e Elasticsearch\u3002 \u4ece elastic.co \u7f51\u7ad9\u63d0\u4f9b\u7684 rpm \u5305\u5b89\u88c5 Elasticsearch\uff0c\u5e76\u5c06\u5176\u914d\u7f6e\u8fd0\u884c\u5728 localhost \u4e0a\uff08\u4ee5\u786e\u4fdd\u8be5\u7a0b\u5e8f\u5b89\u5168\uff0c\u800c\u4e14\u4e0d\u80fd\u4ece\u5916\u90e8\u8bbf\u95ee\uff09\u3002<\/p>\n elastic.co\u7f51\u7ad9\u662f\u4e00\u4e2ahttps\u7684\u7f51\u7ad9\uff08\u79c1\u6709\u8bc1\u4e66\uff09\uff0c\u6211\u4eec\u9700\u8981\u6dfb\u52a0\u8bc1\u4e66\u79d8\u94a5\u624d\u80fd\u5b89\u5168\u7684\u987a\u5229\u4e0b\u8f7d\u3002<\/p>\n \u914d\u7f6e\u6587\u4ef6\u540d\u79f0\uff1aelasticsaerch.yml<\/p>\n \u7f16\u8f91 elasticsearch.service \u6587\u4ef6\u7684\u5185\u5b58\u9501\u914d\u7f6e\u3002<\/p>\n Elasticsearch\u76d1\u542c\u7aef\u53e3\u53f79200\uff0c\u542f\u7528 CentOS \u670d\u52a1\u5668\u4e0a\u542f\u7528mlockall \u6765\u7981\u7528\u5185\u5b58\u4ea4\u6362\uff0c\u8bbe\u7f6eElasticsearch\u5f00\u673a\u81ea\u542f\u52a8\uff0c\u7136\u540e\u542f\u52a8\u670d\u52a1\u3002<\/p>\n \u68c0\u67e5\u5bf9\u5916\u76d1\u542c\u7aef\u53e3\uff1a<\/p>\n <\/p>\n \u5148\u5b89\u88c5Kibana\uff0c\u7136\u540e\u5b89\u88c5nginx\uff0c\u6700\u540e\u8bbe\u7f6enginx\u53cd\u5411\u4ee3\u7406kibana<\/p>\n \u7f16\u8f91 Kibana \u914d\u7f6e\u6587\u4ef6\u3002<\/p>\n \u5c06 Kibana \u8bbe\u4e3a\u5f00\u673a\u542f\u52a8<\/p>\n \u68c0\u67e5Kibana \u5bf9\u5916\u76d1\u542c\u7aef\u53e3 5601 \u786e\u4fdd\u5176\u6b63\u5e38\u542f\u52a8\u3002<\/p>\n <\/p>\n httpd-tools \u8f6f\u4ef6\u5305\u5305\u542b Web \u670d\u52a1\u5668\u7684\u5de5\u5177\uff0c\u53ef\u4ee5\u4e3a Kibana \u6dfb\u52a0 htpasswd \u57fa\u7840\u8ba4\u8bc1\u3002<\/p>\n \u7f16\u8f91 Nginx \u914d\u7f6e\u6587\u4ef6\u5e76\u5220\u9664 server {}\u6a21\u5757\uff0c\u8fd9\u6837\u6211\u4eec\u6dfb\u52a0\u65b0\u7684\u865a\u62df\u4e3b\u673a\u914d\u7f6e\u3002<\/p>\n \u4f7f\u7528 htpasswd \u547d\u4ee4\u521b\u5efa\u4e00\u4e2a\u65b0\u7684\u57fa\u672c\u8ba4\u8bc1\u6587\u4ef6\u3002<\/p>\n \u542f\u52a8 Nginx\u3002<\/p>\n <\/p>\n \u5728\u6b64\u6b65\u9aa4\u4e2d\uff0c\u6211\u4eec\u5c06\u5b89\u88c5 Logstash\uff0c\u5e76\u5c06\u5176\u914d\u7f6e\u4e3a\uff1a\u4ece\u914d\u7f6e\u4e86 filebeat \u7684 logstash \u5ba2\u6237\u7aef\u91cc\u96c6\u4e2d\u5316\u670d\u52a1\u5668\u7684\u65e5\u5fd7\uff0c\u7136\u540e\u8fc7\u6ee4\u548c\u8f6c\u6362 Syslog \u6570\u636e\uff0c\u5e76\u5c06\u5176\u79fb\u52a8\u5230\u5b58\u50a8\u4e2d\u5fc3\uff08Elasticsearch\uff09\u4e2d\u3002<\/p>\n \u4e0b\u8f7d Logstash \u5e76\u4f7f\u7528 rpm \u8fdb\u884c\u5b89\u88c5\u3002<\/p>\n \u751f\u6210\u65b0\u7684 SSL \u8bc1\u4e66\u6587\u4ef6\uff0c\u4ee5\u4fbf\u5ba2\u6237\u7aef\u53ef\u4ee5\u8bc6\u522b elastic \u670d\u52a1\u7aef\u3002<\/p>\n \u4f7f\u7528 openssl \u547d\u4ee4\u751f\u6210\u8bc1\u4e66\u6587\u4ef6\u3002<\/p>\n \u8bc1\u4e66\u6587\u4ef6\u53ef\u4ee5\u5728 \/etc\/pki\/tls\/certs\/ \u548c \/etc\/pki\/tls\/private\/ \u76ee\u5f55\u4e2d\u627e\u5230\u3002<\/p>\n \u63a5\u4e0b\u6765\uff0c\u6211\u4eec\u4f1a\u4e3a Logstash \u521b\u5efa\u65b0\u7684\u914d\u7f6e\u6587\u4ef6\u3002\u521b\u5efa\u4e00\u4e2a\u65b0\u7684 filebeat-input.conf \u6587\u4ef6\u6765\u4e3a filebeat \u914d\u7f6e\u65e5\u5fd7\u6e90\uff0c\u7136\u540e\u521b\u5efa\u4e00\u4e2a syslog-filter.conf \u914d\u7f6e\u6587\u4ef6\u6765\u5904\u7406 syslog\uff0c\u518d\u521b\u5efa\u4e00\u4e2a output-elasticsearch.conf \u6587\u4ef6\u6765\u5b9a\u4e49\u8f93\u51fa\u65e5\u5fd7\u6570\u636e\u5230 Elasticsearch\u3002<\/p>\n \u8f6c\u5230 logstash \u914d\u7f6e\u76ee\u5f55\uff0c\u5e76\u5728 conf.d \u5b50\u76ee\u5f55\u4e2d\u521b\u5efa\u65b0\u7684\u914d\u7f6e\u6587\u4ef6\u3002<\/p>\n \u521b\u5efa syslog-filter.conf \u6587\u4ef6<\/p>\n \u521b\u5efa\u8f93\u51fa\u914d\u7f6e\u6587\u4ef6 output-elasticsearch.conf\u3002<\/p>\n \u542f\u52a8logstash\u670d\u52a1<\/p>\n <\/p>\n Beat \u4f5c\u4e3a\u6570\u636e\u53d1\u9001\u4eba\u7684\u89d2\u8272\uff0c\u662f\u4e00\u79cd\u53ef\u4ee5\u5b89\u88c5\u5728\u5ba2\u6237\u7aef\u8282\u70b9\u4e0a\u7684\u8f7b\u91cf\u7ea7\u4ee3\u7406\uff0c\u5c06\u5927\u91cf\u6570\u636e\u4ece\u5ba2\u6237\u673a\u53d1\u9001\u5230 Logstash \u6216 Elasticsearch \u670d\u52a1\u5668\u3002\u6709 4 \u79cd beat\uff0cFilebeat \u7528\u4e8e\u53d1\u9001\u201c\u65e5\u5fd7\u6587\u4ef6\u201d\uff0cMetricbeat \u7528\u4e8e\u53d1\u9001\u201c\u6307\u6807\u201d\uff0cPacketbeat \u7528\u4e8e\u53d1\u9001\u201c\u7f51\u7edc\u6570\u636e\u201d\uff0cWinlogbeat \u7528\u4e8e\u53d1\u9001 Windows \u5ba2\u6237\u7aef\u7684\u201c\u4e8b\u4ef6\u65e5\u5fd7\u201d\u3002<\/p>\n \u5728\u672c\u6559\u7a0b\u4e2d\uff0c\u6211\u5c06\u5411\u60a8\u5c55\u793a\u5982\u4f55\u5b89\u88c5\u548c\u914d\u7f6e Filebeat\uff0c\u901a\u8fc7 SSL \u8fde\u63a5\u5c06\u6570\u636e\u65e5\u5fd7\u6587\u4ef6\u4f20\u8f93\u5230 Logstash \u670d\u52a1\u5668\u3002<\/p>\n \u767b\u5f55\u5230\u5ba2\u6237\u7aef1\u7684\u670d\u52a1\u5668\u4e0a\u3002 \u7136\u540e\u5c06\u8bc1\u4e66\u6587\u4ef6\u4ece elastic \u670d\u52a1\u5668\u590d\u5236\u5230\u5ba2\u6237\u7aef1\u7684\u670d\u52a1\u5668\u4e0a\u3002<\/p>\n \u63a5\u4e0b\u6765\uff0c\u5728\u5ba2\u6237\u7aef 1 \u670d\u52a1\u5668\u4e0a\u5bfc\u5165 elastic \u5bc6\u94a5\u3002<\/p>\n Filebeat \u5df2\u7ecf\u5b89\u88c5\u597d\u4e86\uff0c\u8bf7\u8f6c\u5230\u914d\u7f6e\u76ee\u5f55\u5e76\u7f16\u8f91 filebeat.yml \u6587\u4ef6\u3002<\/p>\n PS:Filebeat \u9ed8\u8ba4\u4f7f\u7528 Elasticsearch \u4f5c\u4e3a\u8f93\u51fa\u76ee\u6807\u3002 \u5728\u672c\u6559\u7a0b\u4e2d\uff0c\u6211\u4eec\u5c06\u5176\u66f4\u6539\u4e3a Logshtash\u3002<\/p><\/blockquote>\n \u5c06 Filebeat \u8bbe\u5b9a\u4e3a\u5f00\u673a\u542f\u52a8\u5e76\u542f\u52a8\u3002<\/p>\n \u4ece\u670d\u52a1\u7aef\u62f7\u8d1d\u8bc1\u4e66\u6587\u4ef6<\/p>\n \u5728\u670d\u52a1\u5668\u4e0a\u5bfc\u5165 elastic \u5bc6\u94a5\u3002<\/p>\n \u4e0b\u8f7d Filebeat .deb \u5305\u5e76\u4e14\u4f7f\u7528 dpkg \u547d\u4ee4\u8fdb\u884c\u5b89\u88c5\u3002<\/p>\n \u8f6c\u5230\u914d\u7f6e\u76ee\u5f55\u5e76\u7f16\u8f91 filebeat.yml \u6587\u4ef6\u3002<\/p>\n PS:Filebeat \u9ed8\u8ba4\u4f7f\u7528 Elasticsearch \u4f5c\u4e3a\u8f93\u51fa\u76ee\u6807\u3002 \u5728\u672c\u6559\u7a0b\u4e2d\uff0c\u6211\u4eec\u5c06\u5176\u66f4\u6539\u4e3a Logshtash\u3002<\/p><\/blockquote>\n \u5c06 Filebeat \u8bbe\u5b9a\u4e3a\u5f00\u673a\u542f\u52a8\u5e76\u542f\u52a8\u3002<\/p>\n \u68c0\u67e5\u670d\u52a1\u72b6\u6001\uff1a<\/p>\n \u6253\u5f00\u60a8\u7684\u7f51\u7edc\u6d4f\u89c8\u5668\uff0c\u5e76\u8bbf\u95ee\u60a8\u5728 Nginx \u4e2d\u914d\u7f6e\u7684 elastic stack \u57df\u540d\uff0c\u6211\u7684\u662f\u201celk-stack.co\u201d\u3002 \u4f7f\u7528\u7ba1\u7406\u5458\u5bc6\u7801\u767b\u5f55\uff0c\u7136\u540e\u6309 Enter \u952e\u767b\u5f55 Kibana \u4eea\u8868\u76d8\u3002<\/p>\n <\/p>\n \u521b\u5efa\u4e00\u4e2a\u65b0\u7684\u9ed8\u8ba4\u7d22\u5f15 filebeat-*\uff0c\u7136\u540e\u70b9\u51fb\u201c\u521b\u5efa\u201d\u6309\u94ae\u3002 \u9ed8\u8ba4\u7d22\u5f15\u5df2\u521b\u5efa\u3002 \u5982\u679c elastic stack \u4e0a\u6709\u591a\u4e2a beat\uff0c\u60a8\u53ef\u4ee5\u5728\u201c\u661f\u5f62\u201d\u6309\u94ae\u4e0a\u70b9\u51fb\u4e00\u4e0b\u5373\u53ef\u914d\u7f6e\u9ed8\u8ba4 beat\u3002<\/p>\n <\/p>\n \u8f6c\u5230 \u201c\u53d1\u73b0\u201d \u83dc\u5355\uff0c\u60a8\u5c31\u53ef\u4ee5\u770b\u5230 elk-client1 \u548c elk-client2 \u670d\u52a1\u5668\u4e0a\u7684\u6240\u6709\u65e5\u5fd7\u6587\u4ef6\u3002<\/p>\n <\/p>\n \u6765\u81ea elk-client1 \u670d\u52a1\u5668\u65e5\u5fd7\u4e2d\u7684\u65e0\u6548 ssh \u767b\u5f55\u7684 JSON \u8f93\u51fa\u793a\u4f8b\u3002 \u4f7f\u7528\u5176\u4ed6\u7684\u9009\u9879\uff0c\u4f60\u53ef\u4ee5\u4f7f\u7528 Kibana \u4eea\u8868\u76d8\u505a\u66f4\u591a\u7684\u4e8b\u60c5\u3002<\/p>\n Elastic Stack \u5df2\u5b89\u88c5\u5728 CentOS 7 \u670d\u52a1\u5668\u4e0a\u3002 Filebeat \u5df2\u5b89\u88c5\u5728 CentOS 7 \u548c Ubuntu \u5ba2\u6237\u7aef\u4e0a\u3002<\/p>\n via: https:\/\/www.howtoforge.com\/tutorial\/how-to-install-elastic-stack-on-centos-7\/<\/a><\/p>\n \u4f5c\u8005\uff1aMuhammad Arul<\/a> \u8bd1\u8005\uff1aFlowsnow<\/a> \u6821\u5bf9\uff1awxy<\/a><\/p>\n \u672c\u6587\u7531 LCTT<\/a> \u539f\u521b\u7f16\u8bd1\uff0cLinux\u4e2d\u56fd<\/a> \u8363\u8a89\u63a8\u51fa<\/p>\n \u539f\u6587\u6765\u81ea\uff1ahttps:\/\/linux.cn\/article-8460-1.html<\/a><\/p>\n |