ElasticSearch初级开发(1)之ElasticSearch及head插件离线安装
来源:互联网 发布:java中命令行是什么 编辑:程序博客网 时间:2024/06/02 05:15
1.离线安装ElasticSearch
提前下载安装包
url: https://download.elasticsearch.org/elasticsearch/release/org/elasticsearch/distribution/tar/elasticsearch/2.1.0/elasticsearch-2.1.0.tar.gz
环境:
ElasticSearch版本:2.1.0
JDK版本:1.8.0_45
集群:
Kylin 172.16.16.222
Kylin01 172.16.16.223
Kylin02 172.16.16.225
上传安装包(每个节点都要)
[root@kylin Eleasticsearch]# lselasticsearch-2.1.0 [root@kylin Eleasticsearch]# pwd/usr/software/Eleasticsearch
配置elasticsearch.yml(Kylin节点为例)
# ======================== Elasticsearch Configuration =========================## NOTE: Elasticsearch comes with reasonable defaults for most settings.# Before you set out to tweak and tune the configuration, make sure you# understand what are you trying to accomplish and the consequences.## The primary way of configuring a node is via this file. This template lists# the most important settings you may want to configure for a production cluster.## Please see the documentation for further information on configuration options:# <http://www.elastic.co/guide/en/elasticsearch/reference/current/setup-configuration.html>## ---------------------------------- Cluster -----------------------------------## Use a descriptive name for your cluster:# cluster.name: my-application## ------------------------------------ Node ------------------------------------## Use a descriptive name for the node:# node.name: node-1## Add custom attributes to the node:## node.rack: r1## ----------------------------------- Paths ------------------------------------## Path to directory where to store the data (separate multiple locations by comma):# path.data: /usr/software/Eleasticsearch/elasticsearch-2.1.0/local_data/data## Path to log files:# path.logs: /usr/software/Eleasticsearch/elasticsearch-2.1.0/local_data/logs## ----------------------------------- Memory -----------------------------------## Lock the memory on startup:## bootstrap.mlockall: true## Make sure that the `ES_HEAP_SIZE` environment variable is set to about half the memory# available on the system and that the owner of the process is allowed to use this limit.## Elasticsearch performs poorly when the system is swapping the memory.## ---------------------------------- Network -----------------------------------## Set the bind address to a specific IP (IPv4 or IPv6):# network.host: 192.168.1.12 network.publish_host: 192.168.1.12## Set a custom port for HTTP:# http.port: 9200[root@kylin config]# java -versionjava version "1.8.0_45"Java(TM) SE Runtime Environment (build 1.8.0_45-b14)Java HotSpot(TM) 64-Bit Server VM (build 25.45-b02, mixed mode)[root@kylin config]# lselasticsearch.yml logging.yml scripts[root@kylin config]# vi elasticsearch.yml # ======================== Elasticsearch Configuration =========================## NOTE: Elasticsearch comes with reasonable defaults for most settings.# Before you set out to tweak and tune the configuration, make sure you# understand what are you trying to accomplish and the consequences.## The primary way of configuring a node is via this file. This template lists# the most important settings you may want to configure for a production cluster.## Please see the documentation for further information on configuration options:# <http://www.elastic.co/guide/en/elasticsearch/reference/current/setup-configuration.html>## ---------------------------------- Cluster -----------------------------------## Use a descriptive name for your cluster:# cluster.name: my-application## ------------------------------------ Node ------------------------------------## Use a descriptive name for the node:# node.name: node-1## Add custom attributes to the node:## node.rack: r1## ----------------------------------- Paths ------------------------------------## Path to directory where to store the data (separate multiple locations by comma):# path.data: /usr/software/Eleasticsearch/elasticsearch-2.1.0/local_data/data## Path to log files:# path.logs: /usr/software/Eleasticsearch/elasticsearch-2.1.0/local_data/logs## ----------------------------------- Memory -----------------------------------## Lock the memory on startup:## bootstrap.mlockall: true## Make sure that the `ES_HEAP_SIZE` environment variable is set to about half the memory# available on the system and that the owner of the process is allowed to use this limit.## Elasticsearch performs poorly when the system is swapping the memory.## ---------------------------------- Network -----------------------------------## Set the bind address to a specific IP (IPv4 or IPv6):# network.host: 192.168.1.12 network.publish_host: 192.168.1.12## Set a custom port for HTTP:# http.port: 9200## For more information, see the documentation at:# <http://www.elastic.co/guide/en/elasticsearch/reference/current/modules-network.html>## ---------------------------------- Gateway -----------------------------------## Block initial recovery after a full cluster restart until N nodes are started:## gateway.recover_after_nodes: 3## For more information, see the documentation at:# <http://www.elastic.co/guide/en/elasticsearch/reference/current/modules-gateway.html>## --------------------------------- Discovery ----------------------------------## Elasticsearch nodes will find each other via unicast, by default.## Pass an initial list of hosts to perform discovery when new node is started:# The default list of hosts is ["127.0.0.1", "[::1]"]# discovery.zen.ping.unicast.hosts: ["192.168.1.12", "192.168.1.13","192.168.1.14"]## Prevent the "split brain" by configuring the majority of nodes (total number of nodes / 2 + 1):# discovery.zen.minimum_master_nodes: 1## For more information, see the documentation at:# <http://www.elastic.co/guide/en/elasticsearch/reference/current/modules-discovery.html>## ---------------------------------- Various -----------------------------------## Disable starting multiple nodes on a single system:## node.max_local_storage_nodes: 1## Require explicit names when deleting indices:## action.destructive_requires_name: true修改参数说明:
cluster.name:集群名称
node.name:当前节点名称,不要重复
path.data:ES存放数据的目录,自定义
path.data:ES存放数据的目录,自定义
path.logs: ES存放数据的目录,自定义
network.host:当前主机的ip
network.publish_host:当前主机发布的ip
discovery.zen.ping.unicast.hosts:集群中可以作为master节点的初始列表,通过这些节点来自动发现新加入集群的节点
discovery.zen.minimum_master_nodes:配置当前集群中最少的主节点数
至此,ElasticSearch已经配置完成
2.离线安装ElasticSearch插件head
提前下载安装包
url: https://github.com/mobz/elasticsearch-head/archive/master.zip
以kylin为例:
上传至:/usr/software/Eleasticsearch/elasticsearch-2.1.0/down_data/ (自定义)
离线安装
[root@kylin bin]# ./plugin install file:///usr/software/Eleasticsearch/elasticsearch-2.1.0/down_data/elasticsearch-head-master.zip-> Installing from file:/usr/software/Eleasticsearch/elasticsearch-2.1.0/down_data/elasticsearch-head-master.zip...Trying file:/usr/software/Eleasticsearch/elasticsearch-2.1.0/down_data/elasticsearch-head-master.zip ...Downloading .........DONEVerifying file:/usr/software/Eleasticsearch/elasticsearch-2.1.0/down_data/elasticsearch-head-master.zip checksums if available ...NOTE: Unable to verify checksum for downloaded plugin (unable to find .sha1 or .md5 file to verify)Installed head into /usr/software/Eleasticsearch/elasticsearch-2.1.0/plugins/head
查看插件
[root@kylin plugins]# lshead[root@kylin plugins]# pwd/usr/software/Eleasticsearch/elasticsearch-2.1.0/plugins
至此,插件已经安装完毕。
3. 启动所有节点的ElasticSearch
由于ES有执行脚本的能力,因为安全因素考虑,不能在ROOT用户下运行,强行运行会报如下错误:Exception in thread "main"java.lang.RuntimeException: don't run elasticsearch as root.
解决方法:kylin为例
[root@kylin elasticsearch-2.1.0]# groupadd es #增加es组[root@kylin elasticsearch-2.1.0]# useradd es -g es -p pwd #增加es用户并附加到es组[root@kylin elasticsearch-2.1.0]# chown -R es:es /usr/software/Eleasticsearch/elasticsearch-2.1.0 #给目录权限[root@kylin elasticsearch-2.1.0]# su es #使用es用户[es@kylin elasticsearch-2.1.0]$ ./bin/elasticsearch -d #后台运行es
日志:node-1
[2017-06-16 15:20:45,858][WARN ][bootstrap ] unable to install syscall filter: prctl(PR_GET_NO_NEW_PRIVS): Invalid argument[2017-06-16 15:20:46,037][INFO ][node ] [node-1] version[2.1.0], pid[7210], build[72cd1f1/2015-11-18T22:40:03Z][2017-06-16 15:20:46,037][INFO ][node ] [node-1] initializing ...[2017-06-16 15:20:46,161][INFO ][plugins ] [node-1] loaded [], sites [head][2017-06-16 15:20:46,180][INFO ][env ] [node-1] using [1] data paths, mounts [[/ (/dev/vda1)]], net usable_space [122.5gb], net total_space [157.4gb], spins? [possibly], types [ext4][2017-06-16 15:20:47,600][INFO ][node ] [node-1] initialized[2017-06-16 15:20:47,600][INFO ][node ] [node-1] starting ...[2017-06-16 15:20:47,655][INFO ][transport ] [node-1] publish_address {192.168.1.12:9300}, bound_addresses {192.168.1.12:9300}[2017-06-16 15:20:47,663][INFO ][discovery ] [node-1] my-application/5tTEc4fsSn-6nin5R2hI_w[2017-06-16 15:20:50,701][INFO ][cluster.service ] [node-1] new_master {node-1}{5tTEc4fsSn-6nin5R2hI_w}{192.168.1.12}{192.168.1.12:9300}, reason: zen-disco-join(elected_as_master, [0] joins received)[2017-06-16 15:20:50,731][INFO ][http ] [node-1] publish_address {192.168.1.12:9200}, bound_addresses {192.168.1.12:9200}[2017-06-16 15:20:50,731][INFO ][node ] [node-1] started[2017-06-16 15:20:50,821][INFO ][gateway ] [node-1] recovered [0] indices into cluster_state[2017-06-16 15:23:28,886][INFO ][cluster.service ] [node-1] added {{node-2}{b7XHKCyeQaqu1p4aAds3SQ}{192.168.1.13}{192.168.1.13:9300},}, reason: zen-disco-join(join from node[{node-2}{b7XHKCyeQaqu1p4aAds3SQ}{192.168.1.13}{192.168.1.13:9300}])[2017-06-16 15:26:28,959][INFO ][cluster.service ] [node-1] added {{node-3}{RHs5dcPKRnmS0U6E2PmzWA}{192.168.1.14}{192.168.1.14:9300},}, reason: zen-disco-join(join from node[{node-3}{RHs5dcPKRnmS0U6E2PmzWA}{192.168.1.14}{192.168.1.14:9300}])日志:node-2
[2017-06-16 15:23:24,235][WARN ][bootstrap ] unable to install syscall filter: prctl(PR_GET_NO_NEW_PRIVS): Invalid argument[2017-06-16 15:23:24,417][INFO ][node ] [node-2] version[2.1.0], pid[22257], build[72cd1f1/2015-11-18T22:40:03Z][2017-06-16 15:23:24,417][INFO ][node ] [node-2] initializing ...[2017-06-16 15:23:24,530][INFO ][plugins ] [node-2] loaded [], sites [head][2017-06-16 15:23:24,545][INFO ][env ] [node-2] using [1] data paths, mounts [[/ (/dev/vda1)]], net usable_space [52.3gb], net total_space [78.7gb], spins? [possibly], types [ext4][2017-06-16 15:23:25,867][INFO ][node ] [node-2] initialized[2017-06-16 15:23:25,867][INFO ][node ] [node-2] starting ...[2017-06-16 15:23:25,911][INFO ][transport ] [node-2] publish_address {192.168.1.13:9300}, bound_addresses {192.168.1.13:9300}[2017-06-16 15:23:25,918][INFO ][discovery ] [node-2] my-application/b7XHKCyeQaqu1p4aAds3SQ[2017-06-16 15:23:29,020][INFO ][cluster.service ] [node-2] detected_master {node-1}{5tTEc4fsSn-6nin5R2hI_w}{192.168.1.12}{192.168.1.12:9300}, added {{node-1}{5tTEc4fsSn-6nin5R2hI_w}{192.168.1.12}{192.168.1.12:9300},}, reason: zen-disco-receive(from master [{node-1}{5tTEc4fsSn-6nin5R2hI_w}{192.168.1.12}{192.168.1.12:9300}])[2017-06-16 15:23:29,179][INFO ][http ] [node-2] publish_address {192.168.1.13:9200}, bound_addresses {192.168.1.13:9200}[2017-06-16 15:23:29,180][INFO ][node ] [node-2] started[2017-06-16 15:26:29,080][INFO ][cluster.service ] [node-2] added {{node-3}{RHs5dcPKRnmS0U6E2PmzWA}{192.168.1.14}{192.168.1.14:9300},}, reason: zen-disco-receive(from master [{node-1}{5tTEc4fsSn-6nin5R2hI_w}{192.168.1.12}{192.168.1.12:9300}])日志:node-3
[2017-06-16 15:26:23,922][WARN ][bootstrap ] unable to install syscall filter: prctl(PR_GET_NO_NEW_PRIVS): Invalid argument[2017-06-16 15:26:24,104][INFO ][node ] [node-3] version[2.1.0], pid[22551], build[72cd1f1/2015-11-18T22:40:03Z][2017-06-16 15:26:24,104][INFO ][node ] [node-3] initializing ...[2017-06-16 15:26:24,227][INFO ][plugins ] [node-3] loaded [], sites [head][2017-06-16 15:26:24,243][INFO ][env ] [node-3] using [1] data paths, mounts [[/ (/dev/vda1)]], net usable_space [52.3gb], net total_space [78.7gb], spins? [possibly], types [ext4][2017-06-16 15:26:25,619][INFO ][node ] [node-3] initialized[2017-06-16 15:26:25,620][INFO ][node ] [node-3] starting ...[2017-06-16 15:26:25,690][INFO ][transport ] [node-3] publish_address {192.168.1.14:9300}, bound_addresses {192.168.1.14:9300}[2017-06-16 15:26:25,697][INFO ][discovery ] [node-3] my-application/RHs5dcPKRnmS0U6E2PmzWA[2017-06-16 15:26:28,764][INFO ][cluster.service ] [node-3] detected_master {node-1}{5tTEc4fsSn-6nin5R2hI_w}{192.168.1.12}{192.168.1.12:9300}, added {{node-2}{b7XHKCyeQaqu1p4aAds3SQ}{192.168.1.13}{192.168.1.13:9300},{node-1}{5tTEc4fsSn-6nin5R2hI_w}{192.168.1.12}{192.168.1.12:9300},}, reason: zen-disco-receive(from master [{node-1}{5tTEc4fsSn-6nin5R2hI_w}{192.168.1.12}{192.168.1.12:9300}])[2017-06-16 15:26:28,922][INFO ][http ] [node-3] publish_address {192.168.1.14:9200}, bound_addresses {192.168.1.14:9200}[2017-06-16 15:26:28,922][INFO ][node ] [node-3] started
访问url:http://172.16.16.222:9200/
访问url:http://172.16.16.222:9200/_plugin/head/
阅读全文
1 0
- ElasticSearch初级开发(1)之ElasticSearch及head插件离线安装
- elasticsearch 及elasticsearch-head插件安装
- elasticsearch及head插件安装
- elasticsearch 离线安装head,bigdesk插件
- elasticsearch head和sql插件离线安装
- elasticsearch插件安装之--linux下安装及head插件
- [ElasticSearch]ElasticSearch插件之Head
- elasticsearch head插件安装
- elasticsearch-head插件安装
- elasticsearch head插件安装
- Elasticsearch 安装 head 插件
- Elasticsearch Head插件安装
- elasticsearch head插件安装
- elasticsearch-5.6.0及head插件安装
- ElasticSearch 5.0及head插件安装
- Elasticsearch配置及head插件安装
- elasticsearch 5.4.0 安装 及elasticsearch-head 插件
- Elasticsearch之插件head的安装问题
- 深入了解php中的ini配置
- mysql之触发器trigger
- SpringMVC 实现(Post增 Delete删 Put改 get查)
- Ajax动态数据加载+video遮挡div问题解决
- Hadoop2.8.0<Mapreduce实现多表关联>
- ElasticSearch初级开发(1)之ElasticSearch及head插件离线安装
- List集合的特有功能概述
- CentOS6.4使用YUM安装Adobe Flash Player
- 读《乐高:创新者的世界》
- List集合存储学生对象并遍历
- im2double和double函数的区别
- Mybatis中的resultType和resultMap(mybatis执行ddl语句和特殊sql语句)
- QQ空间自动点赞代码
- java类、对象加载机制题目汇总