- 安装jdk
安装jdkde要点主要就是环境变量
导出JAVA_HOME
JRE_HOME
导出可执行程序到PATH变量
tar -zxvf jdk-8u73-linux-x64.tar.gz
tar -zxf jdk-8u73-linux-x64.tar.gz
mv jdk1.8.0_73 /usr/local/jdk
echo "JAVA_HOME=/usr/local/jdk" >>/etc/profile
echo "CLASSPATH=.:$JAVA_HOME/lib.tools.jar" >>/etc/profile
echo "PATH=/usr/local/jdk/bin:/bin:/sbin:/usr/sbin:/bin:/usr/bin:/root/bin" >>/etc/profile
echo "export JAVA_HOME CLASSPATH PATH" >>/etc/profile
source /etc/profile/usr/local/jdk/bin/java -version
java version "1.8.0_73"
Java(TM) SE Runtime Environment (build 1.8.0_73-b02)
Java HotSpot(TM) 64-Bit Server VM (build 25.73-b02, mixed mode)
2. es安装
1) 将es压缩文件移到/opt中
mv elasticsearch-2.3.3.tar.gz /opt/
2)解压,重命名
tar zxvf elasticsearch-2.3.3.tar.gz
mv elasticsearch-2.3.3 elasticsearch
3)由于ElasticSearch可以接收用户输入的脚本并且执行,为了系统安全考虑, 建议创建一个单独的用户用来运行ElasticSearch
groupadd elsearch
useradd elsearch -g elsearch -p elasticsearch
4)更改elasticsearch文件夹及内部文件的所属用户及组为elsearch:elsearch
cd /opt
chown -R elsearch:elsearch elasticsearch
5)切换到elsearch用户再启动
su elsearch cd elasticsearch/bin
./elasticsearch
6)[[email protected] opt]$ cd elasticsearch/bin/
[[email protected] bin]$ ./elasticsearch
[2016-11-14 10:42:43,279][WARN ][bootstrap ] unable to install syscall filter: seccomp unavailable: requires kernel 3.5+ with CONFIG_SECCOMP and CONFIG_SECCOMP_FILTER compiled in
[2016-11-14 10:42:43,760][INFO ][node ] [Armadillo] version[2.3.3], pid[5178], build[218bdf1/2016-05-17T15:40:04Z]
[2016-11-14 10:42:43,760][INFO ][node ] [Armadillo] initializing ...
[2016-11-14 10:42:44,925][INFO ][plugins ] [Armadillo] modules [reindex, lang-expression, lang-groovy], plugins [], sites []
[2016-11-14 10:42:44,962][INFO ][env ] [Armadillo] using [1] data paths, mounts [[/ (/dev/sda3)]], net usable_space [13.1gb], net total_space [44.9gb], spins? [possibly], types [ext4]
[2016-11-14 10:42:44,962][INFO ][env ] [Armadillo] heap size [1007.3mb], compressed ordinary object pointers [true]
[2016-11-14 10:42:44,962][WARN ][env ] [Armadillo] max file descriptors [65535] for elasticsearch process likely too low, consider increasing to at least [65536]
[2016-11-14 10:42:49,414][INFO ][node ] [Armadillo] initialized
[2016-11-14 10:42:49,416][INFO ][node ] [Armadillo] starting ...
[2016-11-14 10:42:49,659][INFO ][transport ] [Armadillo] publish_address {127.0.0.1:9300}, bound_addresses {[::1]:9300}, {127.0.0.1:9300}
[2016-11-14 10:42:49,711][INFO ][discovery ] [Armadillo] elasticsearch/zeSg2GF5TQGMkVZeVD_U_w
[2016-11-14 10:42:52,803][INFO ][cluster.service ] [Armadillo] new_master {Armadillo}{zeSg2GF5TQGMkVZeVD_U_w}{127.0.0.1}{127.0.0.1:9300}, reason: zen-disco-join(elected_as_master, [0] joins received)
[2016-11-14 10:42:52,882][INFO ][http ] [Armadillo] publish_address {127.0.0.1:9200}, bound_addresses {[::1]:9200}, {127.0.0.1:9200}
[2016-11-14 10:42:52,882][INFO ][node ] [Armadillo] started
[2016-11-14 10:42:52,969][INFO ][gateway ] [Armadillo] recovered [0] indices into cluster_state
3.怎么确认是否安装成功
在浏览器中输入 http://ip:9200/ 访问,如果无法访问,需要修改配置文件elasticsearch.yml
# vim /usr/local/src/elasticsearch-2.3.3/config/elasticsearch.yml
# Set the bind address to a specific IP (IPv4 or IPv6):
network.host: localhost
# Set a custom port for HTTP:
http.port: 9200
# ./bin/elasticsearch -d #后台进程启动
再次访问显示如下内容说明成功
{
"name" : "Agron",
"cluster_name" : "elasticsearch",
"version" : {
"number" : "2.3.3",
"build_hash" : "218bdf10790eef486ff2c41a3df5cfa32dadcfde",
"build_timestamp" : "2016-05-17T15:40:04Z",
"build_snapshot" : false,
"lucene_version" : "5.5.0"
},
"tagline" : "You Know, for Search"
}