Elasticsearch学习 -- 01(2.1.0 版本安装)

1、服务器信息

主机名             IP地址          内存大小
qc-hermes-es-1    192.168.0.10    32G
qc-hermes-es-2    192.168.0.11    32G
qc-hermes-es-3    192.168.0.12    32G

2、基础安装

1)JDK安装

# cd /opt
# wget http://xxxx.xxx.xxx.xxx/jdk-8u45-linux-x64.gz
# tar xvzf jdk-8u45-linux-x64.gz
# ln -s jdk1.8.0_45 jdk

# vim /etc/profile

......
export JAVA_HOME=/opt/jdk
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
export PATH=$PATH:$JAVA_HOME/bin
......

# source /etc/profile

2)Elasticsearch安装

# cd /opt
# wget https://download.elasticsearch.org/elasticsearch/release/org/elasticsearch/distribution/tar/elasticsearch/2.1.0/elasticsearch-2.1.0.tar.gz
# tar xvzf elasticsearch-2.1.0.tar.gz
# ln -s elasticsearch-2.1.0 elasticsearch
# mkdir -p /data/logs/elasticsearch
# mkdir -p /data/elasticsearch/{data,work,plugins,scripts}
# useradd elasticsearch -s /bin/bash
# chown -R elasticsearch:elasticsearch /data/logs/elasticsearch /data/elasticsearch

3、Elasticsearch配置

1)主配置(/opt/elasticsearch/config/elasticsearch.yml

qc-hermes-es-1:

cluster.name: qc-hermes-search-cluster
node.name: qc-hermes-es-1
path.data: /data/elasticsearch/data
path.logs: /data/logs/elasticsearch
path.plugins: /data/elasticsearch/plugins
path.scripts: /data/elasticsearch/scripts
bootstrap.mlockall: true
network.host: 192.168.0.10
http.port: 9200
discovery.zen.ping.unicast.hosts: ["qc-hermes-es-1:9200", "qc-hermes-es-2:9200"]
node.master: true
node.data: true
index.number_of_shards: 8
index.number_of_replicas: 1

qc-hermes-es-2:

cluster.name: qc-hermes-search-cluster
node.name: qc-hermes-es-2
path.data: /data/elasticsearch/data
path.logs: /data/logs/elasticsearch
path.plugins: /data/elasticsearch/plugins
path.scripts: /data/elasticsearch/scripts
bootstrap.mlockall: true
network.host: 192.168.0.11
http.port: 9200
discovery.zen.ping.unicast.hosts: ["qc-hermes-es-1:9200", "qc-hermes-es-2:9200"]
node.master: true
node.data: true
index.number_of_shards: 8
index.number_of_replicas: 1

qc-hermes-es-3:

cluster.name: qc-hermes-search-cluster
node.name: qc-hermes-es-3
path.data: /data/elasticsearch/data
path.logs: /data/logs/elasticsearch
path.plugins: /data/elasticsearch/plugins
path.scripts: /data/elasticsearch/scripts
bootstrap.mlockall: true
network.host: 192.168.0.12
http.port: 9200
discovery.zen.ping.unicast.hosts: ["qc-hermes-es-1:9300", "qc-hermes-es-2:9300"]
node.master: true
node.data: true
index.number_of_shards: 8
index.number_of_replicas: 1

2)堆内存配置

# vim /opt/elasticsearch/bin/elasticsearch.in.sh

......
ES_MIN_MEM=20g
ES_MAX_MEM=20g
......

3)服务启动

# cd /opt/elasticsearch
# su elasticsearch
$ bin/elasticsearch -d

说明:2.x的版本需要以普通用户权限启动,否则会报错,无法正常启动。

4)插件安装

# bin/plugin install analysis-icu
# bin/plugin install mobz/elasticsearch-head
# bin/plugin install elasticsearch-analysis-ik
# bin/plugin install lmenezes/elasticsearch-kopf

5)源码安装插件elasticsearch-analysis-ik

# cd /opt
# wget http://mirror.bit.edu.cn/apache/maven/maven-3/3.3.9/binaries/apache-maven-3.3.9-bin.tar.gz
# tar xvzf apache-maven-3.3.9-bin.tar.gz
# ln -s apache-maven-3.3.9 maven

# vim /etc/profile

......
export MAVEN_HOME=/opt/maven
export PATH=$PATH:$MAVEN_HOME/bin
......

# mkdir -p /data/elasticsearch/plugins/ik
# wget https://github.com/medcl/elasticsearch-analysis-ik/archive/v1.6.0.tar.gz -O elasticsearch-analysis-ik-1.6.0.tar.gz
# tar xvzf elasticsearch-analysis-ik-1.6.0.tar.gz
# cd elasticsearch-analysis-ik-1.6.0
# mvn clean
# mvn compile
# mvn package
# unzip target/releases/elasticsearch-analysis-ik-1.6.0.zip -d /data/elasticsearch/plugins/ik

6)插件查看

/opt/elasticsearch/bin/plugin list


你可能感兴趣的:(elasticsearch)