ElasticSearch学习笔记-集群安装部署

集群版本:elasticsearch-2.4.6.tar.gz

集群节点:

centos.master  192.168.10.10

centos.slave1   192.168.10.11

centos.slave2   192.168.10.12

配置文件 elasticsearch.yml:

cluster.name: elasticsearch
node.name: master
node.master: true
node.data: true
path.data: /home/hadoop/software/elasticsearch-2.4.6/data
path.logs: /home/hadoop/software/elasticsearch-2.4.6/logs
bootstrap.mlockall: true
network.host: 192.168.10.10
http.port: 9200
transport.tcp.port: 9300
transport.tcp.compress: true
discovery.zen.ping.unicast.hosts: ["192.168.10.10", "192.168.10.11", "192.168.10.12"]
discovery.zen.minimum_master_nodes: 1
index.refresh_interval: -1
indices.memory.index_buffer_size:  20%
indices.reovery.max_bytes_per_sec: 10gb
index.merge.policy.max_merged_segment: 10gb
index.merge.scheduler.max_thread_count: 3
index.merge.scheduler.max_merge_count: 6
index.translog.flush_threshold_ops: 50000
index.translog.flush_threshold_size: 5gb
index.search.slowlog.level: TRACE
index.search.slowlog.threshold.query.warn: 10s
index.search.slowlog.threshold.query.info: 5s
index.search.slowlog.threshold.query.debug: 2s
index.search.slowlog.threshold.query.trace: 500ms
index.search.slowlog.threshold.fetch.warn: 1s
index.search.slowlog.threshold.fetch.info: 800ms
index.search.slowlog.threshold.fetch.debug: 500ms
index.search.slowlog.threshold.fetch.trace: 200ms
index.indexing.slowlog.threshold.index.warn: 10s
index.indexing.slowlog.threshold.index.info: 5s
index.indexing.slowlog.threshold.index.debug: 2s
index.indexing.slowlog.threshold.index.trace: 500m
security.manager.enabled: false

 

cluster.name: elasticsearch
node.name: slave1
node.master: false
node.data: true
path.data: /home/hadoop/software/elasticsearch-2.4.6/data
path.logs: /home/hadoop/software/elasticsearch-2.4.6/logs
bootstrap.mlockall: true
network.host: 192.168.10.11
http.port: 9200
transport.tcp.port: 9300
transport.tcp.compress: true
discovery.zen.ping.unicast.hosts: ["192.168.10.10", "192.168.10.11", "192.168.10.12"]
discovery.zen.minimum_master_nodes: 1
index.refresh_interval: -1
indices.memory.index_buffer_size:  20%
indices.reovery.max_bytes_per_sec: 10gb
index.merge.policy.max_merged_segment: 10gb
index.merge.scheduler.max_thread_count: 3
index.merge.scheduler.max_merge_count: 6
index.translog.flush_threshold_ops: 50000
index.translog.flush_threshold_size: 5gb
index.search.slowlog.level: TRACE
index.search.slowlog.threshold.query.warn: 10s
index.search.slowlog.threshold.query.info: 5s
index.search.slowlog.threshold.query.debug: 2s
index.search.slowlog.threshold.query.trace: 500ms
index.search.slowlog.threshold.fetch.warn: 1s
index.search.slowlog.threshold.fetch.info: 800ms
index.search.slowlog.threshold.fetch.debug: 500ms
index.search.slowlog.threshold.fetch.trace: 200ms
index.indexing.slowlog.threshold.index.warn: 10s
index.indexing.slowlog.threshold.index.info: 5s
index.indexing.slowlog.threshold.index.debug: 2s
index.indexing.slowlog.threshold.index.trace: 500m
security.manager.enabled: false

 

cluster.name: elasticsearch
node.name: slave2
node.master: false
node.data: true
path.data: /home/hadoop/software/elasticsearch-2.4.6/data
path.logs: /home/hadoop/software/elasticsearch-2.4.6/logs
bootstrap.mlockall: true
network.host: 192.168.10.12
http.port: 9200
transport.tcp.port: 9300
transport.tcp.compress: true
discovery.zen.ping.unicast.hosts: ["192.168.10.10", "192.168.10.11", "192.168.10.12"]
discovery.zen.minimum_master_nodes: 1
index.refresh_interval: -1
indices.memory.index_buffer_size:  20%
indices.reovery.max_bytes_per_sec: 10gb
index.merge.policy.max_merged_segment: 10gb
index.merge.scheduler.max_thread_count: 3
index.merge.scheduler.max_merge_count: 6
index.translog.flush_threshold_ops: 50000
index.translog.flush_threshold_size: 5gb
index.search.slowlog.level: TRACE
index.search.slowlog.threshold.query.warn: 10s
index.search.slowlog.threshold.query.info: 5s
index.search.slowlog.threshold.query.debug: 2s
index.search.slowlog.threshold.query.trace: 500ms
index.search.slowlog.threshold.fetch.warn: 1s
index.search.slowlog.threshold.fetch.info: 800ms
index.search.slowlog.threshold.fetch.debug: 500ms
index.search.slowlog.threshold.fetch.trace: 200ms
index.indexing.slowlog.threshold.index.warn: 10s
index.indexing.slowlog.threshold.index.info: 5s
index.indexing.slowlog.threshold.index.debug: 2s
index.indexing.slowlog.threshold.index.trace: 500m
security.manager.enabled: false

安装插件

[hadoop@centos elasticsearch-2.4.6]$ bin/plugin install mobz/elasticsearch-head

浏览器访问网址 http://centos.master:9200/_plugin/head/ 可以看到集群相关信息

 

[hadoop@centos elasticsearch-2.4.6]$ bin/plugin install lmenezes/elasticsearch-kopf

 

浏览器访问网址 http://centos.master:9200/_plugin/kopf/ 可以看到集群相关信息

 

[hadoop@centos elasticsearch-2.4.6]$ bin/plugin install delete-by-query

可以清除查询到索引类型数据

 

简繁体转换插件

项目地址:https://github.com/medcl/elasticsearch-analysis-stconvert 

mvn clean -X -U -Dmaven.test.skip=true package 编译打包

拷贝release下面的zip并解压到你的es plugins目录下面,重启ES即可

 

拼音插件

项目地址:https://github.com/medcl/elasticsearch-analysis-pinyin.git

 

IK分词插件

项目地址:https://github.com/medcl/elasticsearch-analysis-ik

 

启动各个节点的ElasticSearch服务

[hadoop@centos elasticsearch-2.4.6]$ bin/elasticsearch -d

 

单节点多个ES实例安装部署

在config目录下新建目录instance00、instance01、instance02,拷贝elasticsearch.yml、logging.yml文件至这三个目录下。修改配置文件如下:

cluster.name: elasticsearch
node.name: node-00
path.data: /home/hadoop/software/elasticsearch-2.4.6/data/00
path.logs: /home/hadoop/software/elasticsearch-2.4.6/logs/00
bootstrap.mlockall: true
network.host: 192.168.10.20
http.port: 9200
transport.tcp.port: 9300
discovery.zen.ping.unicast.hosts: ["192.168.10.20:9300"]

 

cluster.name: elasticsearch
node.name: node-01
path.data: /home/hadoop/software/elasticsearch-2.4.6/data/01
path.logs: /home/hadoop/software/elasticsearch-2.4.6/logs/01
bootstrap.mlockall: true
network.host: 192.168.10.20
http.port: 9201
transport.tcp.port: 9301
discovery.zen.ping.unicast.hosts: ["192.168.10.20:9300"]

 

cluster.name: elasticsearch
node.name: node-02
path.data: /home/hadoop/software/elasticsearch-2.4.6/data/02
path.logs: /home/hadoop/software/elasticsearch-2.4.6/logs/02
bootstrap.mlockall: true
network.host: 192.168.10.20
http.port: 9202
transport.tcp.port: 9302
discovery.zen.ping.unicast.hosts: ["192.168.10.20:9300"]


启动节点服务

$ bin/elasticsearch -d -Des.path.conf=config/instance00 -p /tmp/elasticsearch_00.pid

$ bin/elasticsearch -d -Des.path.conf=config/instance01 -p /tmp/elasticsearch_01.pid

$ bin/elasticsearch -d -Des.path.conf=config/instance02 -p /tmp/elasticsearch_02.pid

 

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Elasticsearch是一个基于Lucene的搜索服务器,提供分布式多用户能力的全文搜索引擎,支持RESTful接口,我们可以使用它来进行数据的存储、检索和分析等操作。下面是ElasticSearch2.4.6的安装部署以及集群部署ElasticSearch-head等插件的安装。 ## 安装部署 ### 1. 下载ElasticSearch2.4.6 从官网下载ElasticSearch2.4.6:https://www.elastic.co/downloads/past-releases/elasticsearch-2-4-6 ### 2. 解压缩 将下载好的文件解压缩到指定目录: ``` tar -xzvf elasticsearch-2.4.6.tar.gz -C /usr/local/ ``` ### 3. 修改配置文件 修改`/usr/local/elasticsearch-2.4.6/config/elasticsearch.yml`文件,主要修改以下几项: ``` cluster.name: my-elasticsearch-cluster node.name: my-elasticsearch-node-1 network.host: 0.0.0.0 http.port: 9200 ``` 其中`cluster.name`表示集群名称,`node.name`表示节点名称,`network.host`表示绑定的IP地址,`http.port`表示http监听端口。 ### 4. 启动ElasticSearch 运行以下命令启动Elasticsearch: ``` cd /usr/local/elasticsearch-2.4.6/bin/ ./elasticsearch ``` ### 5. 验证安装 使用浏览器访问`http://localhost:9200/`,如果返回以下信息则表示安装成功: ``` { "name" : "my-elasticsearch-node-1", "cluster_name" : "my-elasticsearch-cluster", "version" : { "number" : "2.4.6", "build_hash" : "5376dca9f70f3abef96a77f4bb22720ace8240fd", "build_timestamp" : "2017-07-18T12:17:44Z", "build_snapshot" : false, "lucene_version" : "5.5.4" }, "tagline" : "You Know, for Search" } ``` ## 集群部署 ### 1. 修改配置文件 在每个节点的`/usr/local/elasticsearch-2.4.6/config/elasticsearch.yml`文件中添加以下内容: ``` cluster.name: my-elasticsearch-cluster node.name: my-elasticsearch-node-1 network.host: 0.0.0.0 http.port: 9200 discovery.zen.ping.unicast.hosts: ["192.168.1.101", "192.168.1.102", "192.168.1.103"] ``` 其中`discovery.zen.ping.unicast.hosts`表示集群中所有节点的IP地址列表。 ### 2. 启动节点 分别在每个节点上启动Elasticsearch: ``` cd /usr/local/elasticsearch-2.4.6/bin/ ./elasticsearch ``` ### 3. 验证集群 使用浏览器访问`http://localhost:9200/_cat/nodes?v`,如果返回以下信息则表示集群启动成功: ``` ip heap.percent ram.percent cpu load_1m load_5m load_15m node.role master name 192.168.1.101 34 98 3 0.00 0.01 0.05 mdi * my-elasticsearch-node-1 192.168.1.102 36 99 0 0.00 0.01 0.05 mdi - my-elasticsearch-node-2 192.168.1.103 31 98 2 0.00 0.01 0.05 mdi - my-elasticsearch-node-3 ``` ## ElasticSearch-head等插件的安装 ### 1. 安装Node.js和npm ElasticSearch-head是一个基于浏览器的Elasticsearch集群管理工具,需要安装Node.js和npm才能使用。使用以下命令安装Node.js和npm: ``` sudo apt-get update sudo apt-get install nodejs npm ``` ### 2. 安装ElasticSearch-head 使用以下命令安装ElasticSearch-head: ``` sudo npm install -g grunt-cli git clone git://github.com/mobz/elasticsearch-head.git cd elasticsearch-head npm install ``` ### 3. 启动ElasticSearch-head 使用以下命令启动ElasticSearch-head: ``` grunt server & ``` 打开浏览器,访问`http://localhost:9100/`,即可打开ElasticSearch-head界面。 至此,ElasticSearch2.4.6的安装部署以及集群部署ElasticSearch-head等插件的安装完成。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值