ÔõÑùÔÚLinuxÉÏÉèÖø߿ÉÓõÄÈÕÖ¾ÆÊÎö¹¤¾ß
ÔõÑùÔÚlinuxÉÏÉèÖø߿ÉÓõÄÈÕÖ¾ÆÊÎö¹¤¾ß
µ¼Ó
ÔÚÏÖ´úµÄITÇéÐÎÖУ¬ÈÕÖ¾ÆÊÎö¹¤¾ßÊÎÑÝ×ÅÖÁ¹ØÖ÷ÒªµÄ½ÇÉ«¡£ËüÃÇÄܹ»×ÊÖúÎÒÃǼà¿ØϵͳµÄ¿µ½¡×´Ì¬¡¢ÊµÊ±Ê¶±ðDZÔÚÎÊÌ⣬²¢ÌṩÓмÛÖµµÄÊý¾ÝÆÊÎöºÍ¿ÉÊÓ»¯¡£±¾ÎĽ«ÏÈÈÝÔõÑùÔÚLinuxϵͳÉÏÉèÖø߿ÉÓõÄÈÕÖ¾ÆÊÎö¹¤¾ß£¬²¢¸½´ø´úÂëʾÀý¹©¶ÁÕ߲ο¼¡£
µÚÒ»²½£º×°ÖÃÓëÉèÖÃElasticsearch¼¯Èº
ElasticsearchÊÇÒ»¸öÓÃÓÚʵʱËÑË÷ºÍÆÊÎöµÄ¿ªÔ´¹¤¾ß£¬±»ÆÕ±éÓ¦ÓÃÓÚÈÕÖ¾ÆÊÎöÁìÓò¡£ÎªÁËʵÏָ߿ÉÓÃÐÔ£¬ÎÒÃǽ«ÔÚLinuxÉϴElasticsearch¼¯Èº¡£
1.Ê×ÏÈ£¬ÄúÐèҪ׼±¸ºÃÒ»¸ö»ò¶à¸öЧÀÍÆ÷£¬ÒԱ㰲ÅÅElasticsearch½Úµã¡£Ã¿¸ö½Úµã¶¼ÐèÒª¾ß±¸ÒÔÏÂÌõ¼þ£º
ÓµÓÐ×ã¹»µÄÄÚ´æºÍ´æ´¢¿Õ¼ä£»
ÔËÐÐLinux²Ù×÷ϵͳ£¬²¢ÇÒÄܹ»Ï໥»á¼û¡£
2.ÔÚÿ¸ö½ÚµãÉÏ£¬ÏÂÔØElasticsearchÈí¼þ°ü£¬²¢½âѹËõµ½Ò»¸öĿ¼ÖУº
wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.10.1-linux-x86_64.tar.gz tar -xvf elasticsearch-7.10.1-linux-x86_64.tar.gz
µÇ¼ºó¸´ÖÆ
3.½øÈë½âѹºóµÄĿ¼£¬±à¼ÉèÖÃÎļþelasticsearch.yml£º
cd elasticsearch-7.10.1 vim config/elasticsearch.yml
µÇ¼ºó¸´ÖÆ
ÔÚ¸ÃÎļþÖУ¬ÄúÐèÒªÐ޸ĻòÌí¼ÓÒÔϲÎÊý£º
cluster.name: my-cluster node.name: node-1 path.data: /path/to/data path.logs: /path/to/logs network.host: 0.0.0.0
µÇ¼ºó¸´ÖÆ
ÇëÈ·±£½«/path/to/dataºÍ/path/to/logsÌ滻ΪÊʺÏÄúϵͳµÄÏÖʵ·¾¶¡£
4.Öظ´ÒÔÉÏ°ì·¨£¬ÔÚÆäËû½ÚµãÉϾÙÐÐ×°ÖúÍÉèÖá£
5.ÔÚÿ¸ö½ÚµãÉÏÆô¶¯Elasticsearch£º
./bin/elasticsearch
µÇ¼ºó¸´ÖÆ
6.ÑéÖ¤Elasticsearch¼¯ÈºÊÇ·ñÀÖ³ÉÆô¶¯¡£Äú¿ÉÒÔʹÓÃcurlÏÂÁî·¢ËÍHTTPÇëÇó£º
curl -XGET http://localhost:9200/_cluster/state?pretty=true
µÇ¼ºó¸´ÖÆ
ÈôÊÇ·µ»ØµÄЧ¹ûÖаüÀ¨ÓйØÄúµÄ¼¯ÈºÐÅÏ¢£¬ÄÇô˵Ã÷¼¯ÈºÒѾÀÖ³ÉÆô¶¯¡£
µÚ¶þ²½£º×°ÖÃÓëÉèÖÃLogstash
LogstashÊÇÒ»¸ö¿ªÔ´µÄÊý¾ÝÍøÂçÒýÇ棬¿ÉÒÔ½«Êý¾Ý´ÓÖÖÖÖȪԴ¶ÁÈ¡²¢´æ´¢µ½Ö¸¶¨µÄÄ¿µÄµØ¡£ÔÚ±¾ÎÄÖУ¬ÎÒÃǽ«Ê¹ÓÃLogstashÀ´½«ÈÕÖ¾Êý¾Ý·¢Ë͵½ÉÏÒ»²½ÖдµÄElasticsearch¼¯Èº¡£
1.ÔÚÿ¸ö½ÚµãÉÏÏÂÔز¢×°ÖÃLogstash£º
wget https://artifacts.elastic.co/downloads/logstash/logstash-7.10.1.tar.gz tar -xvf logstash-7.10.1.tar.gz
µÇ¼ºó¸´ÖÆ
2.±à¼ÉèÖÃÎļþlogstash.yml£º
cd logstash-7.10.1 vim config/logstash.yml
µÇ¼ºó¸´ÖÆ
È·±£ÉèÖÃnode.nameºÍpath.data²ÎÊý¡£
3.½¨ÉèÒ»¸öеÄLogstashÉèÖÃÎļþlogstash.conf£º
vim config/logstash.conf
µÇ¼ºó¸´ÖÆ
ÔÚ¸ÃÎļþÖУ¬Äú¿ÉÒÔʹÓòî±ðµÄÊäÈë²å¼þºÍÊä³ö²å¼þÀ´½ç˵Êý¾ÝµÄȪԴºÍÄ¿µÄµØ¡£ÀýÈ磬ÒÔÏÂʾÀý½«´Ó±ê×¼ÊäÈë¶ÁÈ¡Êý¾Ý£¬²¢½«Æä·¢Ë͵½Elasticsearch¼¯ÈºÖУº
input { stdin {} } output { elasticsearch { hosts => ["localhost:9200"] index => "my-index" } }
µÇ¼ºó¸´ÖÆ
4.ÔÚÿ¸ö½ÚµãÉÏÆô¶¯Logstash£º
./bin/logstash -f config/logstash.conf
µÇ¼ºó¸´ÖÆ
µÚÈý²½£ºÊ¹ÓÃKibana¾ÙÐÐÊý¾ÝÆÊÎöºÍ¿ÉÊÓ»¯
KibanaÊÇÒ»¸öÓÃÓÚÊý¾ÝÆÊÎöºÍ¿ÉÊÓ»¯µÄ¿ªÔ´¹¤¾ß£¬Äܹ»Ö±¹ÛµØչʾElasticsearchÖеÄÊý¾Ý¡£
1.ÏÂÔز¢×°ÖÃKibana£º
wget https://artifacts.elastic.co/downloads/kibana/kibana-7.10.1-linux-x86_64.tar.gz tar -xvf kibana-7.10.1-linux-x86_64.tar.gz
µÇ¼ºó¸´ÖÆ
2.±à¼ÉèÖÃÎļþkibana.yml£º
cd kibana-7.10.1-linux-x86_64 vim config/kibana.yml
µÇ¼ºó¸´ÖÆ
È·±£ÉèÖÃelasticsearch.hosts²ÎÊý£¬Ö¸ÏòElasticsearch¼¯ÈºµÄµØµã¡£
3.Æô¶¯Kibana£º
./bin/kibana
µÇ¼ºó¸´ÖÆ
4.ÔÚä¯ÀÀÆ÷Öлá¼ûKibanaµÄWeb½çÃ棬ĬÈϵصãΪhttp://localhost:5601¡£
ÔÚKibanaÖУ¬Äú¿ÉÒÔ½¨ÉèÒDZí°å¡¢Í¼±íºÍ¿ÉÊÓ»¯×é¼þ£¬ÒÔչʾºÍÆÊÎöElasticsearchÖд洢µÄÊý¾Ý¡£
¿¢ÊÂÓ
ͨ¹ýÉèÖø߿ÉÓõÄÈÕÖ¾ÆÊÎö¹¤¾ß£¬Äú¿ÉÒÔ¸üºÃµØ¼à¿ØºÍÆÊÎöϵͳÈÕÖ¾£¬ÊµÊ±·¢Ã÷ÎÊÌâ²¢¾ÙÐÐÓ¦¶Ô¡£±¾ÎÄÏÈÈÝÁËÔÚLinuxϵͳÉÏÉèÖÃElasticsearch¼¯Èº¡¢×°ÖÃLogstashºÍKibanaµÄ°ì·¨£¬²¢ÌṩÁËÏà¹Ø´úÂëʾÀý¡£Ï£ÍûÕâЩÐÅÏ¢ÄܶÔÄúÔÚÈÕÖ¾ÆÊÎöÁìÓòµÄÊÂÇéÓÐËù×ÊÖú¡£
ÒÔÉϾÍÊÇÔõÑùÔÚLinuxÉÏÉèÖø߿ÉÓõÄÈÕÖ¾ÆÊÎö¹¤¾ßµÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡