Elasticsearch && Elasticsearch Head 安裝
阿新 • • 發佈:2019-01-08
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查詢