1、配置java环境
检查java环境
满足elasticsearch6.1.1java环境要求;
2、安装ElasticSearch6.1.1
①为es新生成用户、用户组
su root
groupadd esgroup
useradd ela -g esgroup -p 5tgbhu8
[root@localhost fibonacci]# su ela
Attempting to create directory /home/ela/perl5
[ela@localhost fibonacci]$
②进入ela用户工作目录,将elasticsearch-6.1.1,kibana-6.1.1,x-pck-6.1.1拷到工作目录待用,注意版本号必须一模一样,否则会出错;
[ela@localhost Work]$ ls
elasticsearch-6.1.1.tar.gz kibana6.1.1.gz x-pack-6.1.1.zip
③解压elasticsearch-6.1.1.tar.gz,拷贝到/opt中;
tar -zxvf elasticsearch-6.1.1.tar.gz
[ela@localhost Work]$ ls
elasticsearch-6.1.1 elasticsearch-6.1.1.tar.gz kibana6.1.1.gz x-pack-6.1.1.zip
[ela@localhost Work]$ su root
Password:
[root@localhost Work]# cp -r elasticsearch-6.1.1 /opt/
cd /opt/
chown -R ela:esgroup elasticsearch-6.1.1/
④试运行elasticsearch;
[ela@localhost opt]$ cd /opt/elasticsearch-6.1.1/
[ela@localhost elasticsearch-6.1.1]$ bin/elasticsearch
运气比较好,这次成功了,如下出现started表示elasticsearch运行成功:
[2019-11-22T10:06:57,893][INFO ][o.e.n.Node ] [nwkzLZ5] started
[2019-11-22T10:06:57,898][INFO ][o.e.g.GatewayService ] [nwkzLZ5] recovered [0] indices into cluster_state
使用curl在本机(虚拟机)测试一下成功如下:
[fibonacci@localhost ~]$ curl 127.0.0.1:9200
{
"name" : "nwkzLZ5",
"cluster_name" : "elasticsearch",
"cluster_uuid" : "EYzfoBkET_q85hsPsVzIDQ",
"version" : {
"number" : "6.1.1",
"build_hash" : "bd92e7f",
"build_date" : "2017-12-17T20:23:25.338Z",
"build_snapshot" : false,
"lucene_version" : "7.1.0",
"minimum_wire_compatibility_version" : "5.6.0",
"minimum_index_compatibility_version" : "5.0.0"
},
"tagline" : "You Know, for Search"
}
要想在其它计算机上可以访问虚拟机数据库,就要简单设置配置文件:
在/opt/elasticsearch-6.1.1/config中找到elasticsearch.yml,简单设置elasticsearch配置文件,实现局域网其它机器可以访问该elasticsearch;
# Set the bind address to a specific IP (IPv4 or IPv6):
#
network.host: 192.168.1.211
#
# Set a custom port for HTTP:
#
http.port: 9200
#
# For more information, consult the network module documentation.
配置完这个就出现下面的问题了: