java环境部署:
0 1 2 3 4 5 6 7 8 9 10 11 |
[root@ELK ~]# mkdir /byrd/service -p [root@ELK ~]# mkdir /byrd/tools [root@ELK ~]# cd /byrd/tools/ [root@ELK tools]# wget http://download.oracle.com/otn-pub/java/jdk/8u101-b13/jdk-8u101-linux-x64.tar.gz [root@ELK tools]# tar zxf jdk-8u101-linux-x64.tar.gz [root@ELK tools]# mv jdk1.8.0_101/ /byrd/service/ [root@ELK tools]# ln -s /byrd/service/jdk1.8.0_101 /usr/local/jdk [root@ELK tools]# source /etc/profile [root@ELK tools]# tail -3 /etc/profile export JAVA_HOME=/usr/local/jdk export PATH=$JAVA_HOME/bin:$JAVA_HOME/jre/bin:$PATH export CLASSPATH=.$CLASSPATH:$JAVA_HOME/lib:$JAVA_HOME/jre/lib:$JAVA_HOME/lib/tools.jar |
elasticsearch:
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 |
[root@ELK tools]# wget https://download.elastic.co/elasticsearch/release/org/elasticsearch/distribution/tar/elasticsearch/2.4.0/elasticsearch-2.4.0.tar.gz [root@ELK tools]# tar zxf elasticsearch-2.4.0.tar.gz [root@ELK tools]# mv elasticsearch-2.4.0 /byrd/service/ [root@ELK tools]# ln -s /byrd/service/elasticsearch-2.4.0 /usr/local/elasticsearch [root@ELK-node1 tools]# git clone https://github.com/elasticsearch/elasticsearch-servicewrapper.git [root@ELK-node1 tools]# cp -ap elasticsearch-servicewrapper/service/ /usr/local/elasticsearch/bin/ [root@ELK-node1 elasticsearch]# mkdir /usr/local/elasticsearch/{logs,plugins,data,conf,work} [root@ELK-node1 elasticsearch]# useradd elasticsearch [root@ELK-node1 elasticsearch]# chown -R elasticsearch.elasticsearch /usr/local/elasticsearch/ [root@ELK-node1 elasticsearch]# grep -v "^$\|#" config/elasticsearch.yml [root@ELK-node1 elasticsearch]# grep '^[a-z]' config/elasticsearch.yml cluster.name: log.t4x.org node.name: "Node-1" node.master: true node.data: true index.number_of_shards: 5 index.number_of_replicas: 2 path.conf: /usr/local/elasticsearch/conf path.data: /usr/local/elasticsearch/data path.work: /usr/local/elasticsearch/work path.logs: /usr/local/elasticsearch/logs path.plugins: /usr/local/elasticsearch/plugins bootstrap.mlockall: true network.bind_host: 1.1.1.117 http.port: 9200 transport.tcp.compress: true transport.tcp.port: 9300 [elasticsearch@ELK-node1 ~]$ /usr/local/elasticsearch/bin/elasticsearch [root@ELK-node1 elasticsearch]# netstat -tunlp Active Internet connections (only servers) Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1324/sshd tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 1403/master tcp 0 0 ::ffff:1.1.1.117:9200 :::* LISTEN 2931/java tcp 0 0 ::ffff:1.1.1.117:9300 :::* LISTEN 2931/java tcp 0 0 :::22 :::* LISTEN 1324/sshd tcp 0 0 ::1:25 :::* LISTEN 1403/master [root@ELK-node1 elasticsearch]# curl http://1.1.1.117:9200 { "name" : "Node-1", "cluster_name" : "log.t4x.org", "version" : { "number" : "2.4.0", "build_hash" : "ce9f0c7394dee074091dd1bc4e9469251181fc55", "build_timestamp" : "2016-08-29T09:14:17Z", "build_snapshot" : false, "lucene_version" : "5.5.2" }, "tagline" : "You Know, for Search" } [root@ELK-node1 elasticsearch]# jps 2211 Jps 2111 Elasticsearch [root@ELK-node1 elasticsearch]# kill 2111 [root@ELK-node1 ~]# curl -XGET 'http://1.1.1.117:9200/_count?pretty' -d ' > { > "query":{ > "match_all":{} > } > } > ' { "count" : 0, "_shards" : { "total" : 0, "successful" : 0, "failed" : 0 } } [root@ELK-node1 ~]# /usr/local/elasticsearch/bin/plugin install elasticsearch/marvel/latest [root@ELK-node1 elasticsearch]# /usr/local/elasticsearch/bin/plugin install elasticsearch/marvel/latest -> Installing elasticsearch/marvel/latest... Trying http://download.elasticsearch.org/elasticsearch/marvel/marvel-latest.zip... Downloading ........................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................DONE Installed elasticsearch/marvel/latest into /usr/local/elasticsearch/plugins/marvel [root@ELK-node1 plugins]# tree /usr/local/elasticsearch/plugins/ -L 2 /usr/local/elasticsearch/plugins/ └── marvel ├── LICENSE.txt ├── marvel-1.3.1.jar └── _site 2 directories, 2 files 浏览器:http://1.1.1.117:9200/_plugin/marvel/kibana/index.html [root@ELK-node1 elasticsearch]# ./bin/plugin install mobz/elasticsearch-head [root@ELK-node1 config]# curl -XGET http://1.1.1.117:9200/_cluster/health?pretty { "cluster_name" : "log-t4x-org", "status" : "green", "timed_out" : false, "number_of_nodes" : 2, "number_of_data_nodes" : 2, "active_primary_shards" : 0, "active_shards" : 0, "relocating_shards" : 0, "initializing_shards" : 0, "unassigned_shards" : 0, "delayed_unassigned_shards" : 0, "number_of_pending_tasks" : 0, "number_of_in_flight_fetch" : 0, "task_max_waiting_in_queue_millis" : 0, "active_shards_percent_as_number" : 100.0 } |
nginx:
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
[root@Lnmp01 conf]# cat nginx.conf events { worker_connections 1024; } http { upstream elasticsearch { server 1.1.1.117:9200; } server { listen 8080; auth_basic "Protected Elasticsearch"; auth_basic_user_file /usr/local/nginx/conf/htpasswd; location / { proxy_pass http://elasticsearch; proxy_redirect off; } } } |
相关资料:https://www.elastic.co/blog/playing-http-tricks-nginx SourceByrd's Weblog-https://note.t4x.org/other/elasticsearch-configure-install/
申明:除非注明Byrd's Blog内容均为原创,未经许可禁止转载!详情请阅读版权申明!