Elasticsearch && Elasticsearch Head 安装
hostname | ip |
---|---|
cluster-master | 192.168.120.5 |
cluster-slave1 | 192.168.120.6 |
cluster-backup | 192.168.120.7 |
环境配置每个节点都执行
mkdir -p /home/qun/data/es/data
mkdir -p /home/qun/data/es/log
[[email protected] ~]$ cat /etc/security/limits.conf
* soft nofile 65536
* hard nofile 131072
* soft nproc 2048
* hard nproc 4096
[[email protected] ~]$ cat /etc/sysctl.conf
# sysctl settings are defined through files in
# /usr/lib/sysctl.d/, /run/sysctl.d/, and /etc/sysctl.d/.
#
# Vendors settings live in /usr/lib/sysctl.d/.
# To override a whole file, create a new file with the same in
# /etc/sysctl.d/ and put new settings there. To override
# only specific settings, add a file with a lexically later
# name in /etc/sysctl.d/ and put new settings there.
#
# For more information, see sysctl.conf(5) and sysctl.d(5).
vm.max_map_count=262144
下载
wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-6.5.1.tar.gz
tar -zxvf elasticsearch-6.5.1.tar.gz
配置
vi elasticsearch.yml
cluster.name: myes
node.name: node1
path.data: /home/qun/data/es/data
path.logs: /home/qun/data/es/log
http.port: 9200
network.host: 0.0.0.0
discovery.zen.ping.unicast.hosts: ["192.168.120.5", "192.168.120.6","192.168.120.7"]
discovery.zen.minimum_master_nodes: 3
http.cors.enabled: true
http.cors.allow-origin: "*"
分发安装文件
scp -r elasticsearch-6.5.1 [email protected]:~/
scp -r elasticsearch-6.5.1 [email protected]:~/
修改cluster-slave1和cluster-backup配置文件
cluster-slave1节点
vi elasticsearch.yml
node.name: node2
cluster-backup节点
vi elasticsearch.yml
node.name: node3
启动
在三个节点分别执行
bin/elasticsearch &
配置elasticsearch-head
下载配置nodejs
wget https://nodejs.org/dist/v10.14.1/node-v10.14.1-linux-x64.tar.xz
tar -xvf node-v10.14.1-linux-x64.tar.xz
vi ~/.bashrc
export JAVA_HOME=/home/qun/jdk1.8.0_181
export NODE_HOME=/home/qun/node-v10.14.1-linux-x64
export SCALA_HOME=/home/qun/scala-2.11.12
export HADOOP_HOME=/home/qun/hadoop-2.8.4
export HBASE_HOME=/home/qun/hbase-2.1.1
export HIVE_HOME=/home/qun/apache-hive-2.3.3-bin
export MAVEN_HOME=/home/qun/apache-maven-3.5.4
export ZOOKEEPER_HOME=/home/qun/zookeeper-3.4.10
export PATH=$PATH:$JAVA_HOME/bin:$HADOOP_HOME/bin:$HADOOP_HOME/sbin:$HIVE_HOME/bin:$MAVEN_HOME/bin:$IMPALA_HOME/bin:$ZOOKEEPER_HOME/bin:$DRUID/bin:$SLIDER_HOME/bin:$SENTRY_HOME/bin:$HBASE_HOME/bin:$SCALA_HOME/bin:$NODE_HOME/bin
下载安装启动elasticsearch-head
git clone https://github.com/mobz/elasticsearch-head.git
cd elasticsearch-head
npm install -g grunt-cli
npm install
grunt server
查看elasticsearch-head web 控制台
http://192.168.120.5:9100/
创建一个index,这里使用的是google 浏览器的postman插件;
这里需要注意的是,虽然我们指定http://192.168.120.5:9200/customer?pretty发送Put请求创建Index,其实只要指定集群中任何一台节点都可以
查看集群状态
插入数据
执行sql查询