1. 下载安装包
下载elasticsearch:
https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-5.1.1.tar.gz
下载ES-Hadoop:
https://www.elastic.co/downloads/hadoop
tar -zxvf elasticsearch-5.1.1.tar.gz
cd $ES_HOME/
vi config/elasticsearch.yml
cluster.name: my-application
node.name: node-1
network.host: 192.168.17.50
http.port: 9200
discovery.zen.ping.unicast.hosts: ["192.168.17.50"]
discovery.zen.minimum_master_nodes: 3
启动elasticsearch
./bin/elasticsearch
以后台方式启动elasticsearch
./bin/elasticsearch -d -p pid
kill `cat pid`
访问测试一下:
curl http://192.168.17.50:9200
返回如下信息:安装成功
{
"name" : "SfD5sIh",
"cluster_name" : "my-application",
"cluster_uuid" : "cbvv-D-JS0WM5RWZypjNmw",
"version" : {
"number" : "5.1.1",
"build_hash" : "5395e21",
"build_date" : "2016-12-06T12:36:15.409Z",
"build_snapshot" : false,
"lucene_version" : "6.3.0"
},
"tagline" : "You Know, for Search"
}
处理启动报错一:
[2017-01-12T15:55:55,433][INFO ][o.e.b.BootstrapCheck ] [SfD5sIh] bound or publishing to a non-loopback or non-link-local address, enforcing bootstrap checks
ERROR: bootstrap checks failed
max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
- 临时提高了vm.max_map_count的大小,此操作需要root权限:
sudo sysctl -w vm.max_map_count=262144
sysctl -a|grep vm.max_map_count
- 永久修改vm.max_map_count:
解决:切换到root用户修改配置sysctl.conf
vi /etc/sysctl.conf
添加下面配置:
vm.max_map_count=655360
并执行命令:
sysctl -p
然后,重新启动elasticsearch,即可启动成功。
处理启动报错二:
2017-01-12T16:12:22,404][INFO ][o.e.b.BootstrapCheck ] [SfD5sIh] bound or publishing to a non-loopback or non-link-local address, enforcing bootstrap checks
ERROR: bootstrap checks failed
initial heap size [536870912] not equal to maximum heap size [1073741824]; this can cause resize pauses and prevents mlockall from locking the entire heap
解决方法:
vi config/jvm.options
###-Xms 和 -Xmx需要配置的相等,不然无法启动成功。
-Xms1024m
-Xmx1024m