centos7 下面安装elasticsearch5
1,首先安装好jdk,如果需要请查看jdk1.8安装配置
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
#官方下载地址:
http:
//www
.oracle.com
/technetwork/java/javase/downloads/jdk8-downloads-2133151
.html
#解压包
tar
xf jdk-8u131-linux-x64.
tar
.gz -C
/usr/local
#修改系统变量
vim
/etc/profile
最下面添加
JAVA_HOME=
/usr/local/jdk1
.8.0_131
JRE_HOME=$JAVA_HOME
/jre
PATH=$PATH:$JAVA_HOME
/bin
:$JRE_HOME
/bin
CLASSPATH=:$JAVA_HOME
/lib/dt
.jar:$JAVA_HOME
/lib/tools
.jar:$JRE_HOME
/lib/dt
.jar
export
JAVA_HOME JRE_HOME PATH CLASSPATH
#重新读取系统变量
source
/etc/profile
#验证版本
[root@localhost ~]
#java -version
java version
"1.8.0_131"
Java(TM) SE Runtime Environment (build 1.8.0_131-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.131-b11, mixed mode)
|
2,elasticsearch 安装前需要修改的配置和安装过程
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
|
【使用root用户操作 --start】
elasticsearch 使用非root用户启动
#创建一个用户用来启动es
useradd
elastic
passwordd elastic
#我这里使用root用户下载并授权给elastic
下载/解压包
wget https:
//artifacts
.elastic.co
/downloads/elasticsearch/elasticsearch-5
.4.1.
tar
.gz
tar
xf elasticsearch-5.4.1.
tar
.gz
移动/更名
mv
elasticsearch-5.4.1
/usr/local/elsticsearch
chown
-R elastic.elastic
/usr/local/elsticsearch
由于系统的一些配置限制导致启动时候的问题,这里写修改需要修改的配置文件
错误1【PS:我这里打开最大文件数是已修改过为65535的,es提示要65536】
max
file
descriptors [65535]
for
elasticsearch process is too low, increase to at least [65536]
解决:
vim
/etc/security/limits
.conf
#添加下面内容
* soft nofile 65536
* hard nofile 65536
错误2
max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
解决:
vim
/etc/sysctl
.conf
#添加下面一句
vm.max_map_count=262144
#再执行读取生效下
sysctl -p
【使用root用户操作 --stop】
【使用elastic用户操作 --start】
su
- elastic
#修改配置文件
vim
/usr/local/elsticsearch/config/elasticsearch
.yml
#修改下面两个
network.host: 0.0.0.0
http.port: 9200
#启动
/usr/local/elsticsearch/bin/elasticsearch
-d
#查看端口启动情况
netstat
-lntp |
egrep
"9200|9300"
tcp 0 0 0.0.0.0:9200 0.0.0.0:* LISTEN 14203
/java
tcp 0 0 0.0.0.0:9300 0.0.0.0:* LISTEN 14203
/java
#启动成功,如果没有端口查看日志中错误,自行百度谷歌一一排错
cat
/usr/local/elsticsearch/logs/elasticsearch
.log
#如果机器配置低的话,elsticsearch 默认2G的内存,需要修改内存
vim
/usr/local/elsticsearch/config/jvm
.options
#默认为2g,修改为适当的值,我这里机器4G内存,修改为1G
-Xms1g
-Xmx1g
【使用elasitc用户操作 --stop】
|
本文转自无形于有形 51CTO博客,原文链接:http://blog.51cto.com/jinchuang/1947009,如需转载请自行联系原作者