您的位置:首页 > 运维架构

cool-2018-03-09-elasticsearch集群安装

2018-03-09 16:39 169 查看
说在前面的话:将索引建立在elasticsearch这样一个分布式的全文搜索引擎里面,再将数据存储在hbase中这样的需求是非常常见的,也是非常重要的,比如在旅游网站,视频网站,58同城这样的网站中都是非常需要这样的技术elasticsearch需要hdfs和zookeeper环境基础开始搭建:elasticsearch安装搭建环境准备:centos,vmware,3台虚拟机node1,node2,node3所有节点安装elasticsearch-2.2.0.tar.gz
第一步:解压elasticsearch-2.2.0.tar.gztar -zvxf elasticsearch-2.2.0.tar.gz移动到home目录下mv elasticsearch-2.2.0 /home/切换目录cd /home/elasticsearch-2.2.0[root@node1 elasticsearch-2.2.0]# vi config/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: chenkl## ------------------------------------ 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: /path/to/data## Path to log files:## path.logs: /path/to/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.149.130## 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>## --------------------------------- Discovery ----------------------------------## 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: ["host1", "host2"]## Prevent the "split brain" by configuring the majority of nodes (total number of nodes / 2 + 1):### 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.149.130## 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>## --------------------------------- Discovery ----------------------------------## 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: ["host1", "host2"]## Prevent the "split brain" by configuring the majority of nodes (total number of nodes / 2 + 1):## discovery.zen.minimum_master_nodes: 3## ---------------------------------- 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>## ---------------------------------- 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: truediscovery.zen.ping.multicast.enabled: falsediscovery.zen.ping_timeout: 120sclient.transport.ping_timeout: 60sdiscovery.zen.ping.unicast.hosts: ["192.168.149.130","192.168.149.131", "192.168.149.132"]
复制到其他机器上[root@node1 home]# scp -r elasticsearch-2.2.0/ root@node2:/home/[root@node1 home]# scp -r elasticsearch-2.2.0/ root@node3:/home/更改相应的配置所有节点创建用户[root@node1 ~]# adduser bigdata[root@node1 ~]# su bigdata[root@node4 ~]# su bigdata[bigdata@node4 root]$ exit[root@node1 ~]# chown -R bigdata:bigdata ../[root@node1 ~]# su bigdata[bigdata@node4 root]$ cd /home/elasticsearch-2.2.0[bigdata@node4 elasticsearch-2.2.0]$ bin/elasticsearchCtrl+c可以停止上面开启的服务到此elasticsearch安装启动完毕
一. 安装Kibana随便找一台虚拟机 解压安装,修改配置文件vi config/kibana.yml的elasticsearch.url属性即可

 注意配置yml结尾的配置文件都需要冒号后面加空格才行elasticsearch安装插件,所有节点[root@node1 home]# cd elasticsearch-2.2.0/[root@node1 elasticsearch-2.2.0]# bin/plugin install license[root@node1 elasticsearch-2.2.0]# bin/plugin install marvel-agent单独的装有kibana的节点安装[root@node1 kibana-4.4.1-linux-x64]# bin/kibana plugin --install elasticsearch/marvel/latest接下来启动elasticsearch和kibana[bigdata@node4 elasticsearch-2.2.0]$ bin/elasticsearch浏览器输入:http://192.168.149.131:9200 访问[root@node1 kibana-4.4.1-linux-x64]# bin/kibana浏览器输入:http://192.168.149.130:5601 访问elasticsearch集成分词器[bigdata@node4 elasticsearch-2.2.0]$ makdir plugins/ikelasticsearch-analysis-ik-1.8.0.zip放入这个ik目录中[bigdata@node4 ik]$ unzip elasticsearch-analysis-ik-1.8.0.zip[bigdata@node4 ik]$ ll要有这么几个文件common-codec-1,9.jarcommon-logging-1.2.jarconfigelastcsearch-analysis-ik-1.8.0.jarhttpclient-4.4.1.jarhttpcore-4.4.1.jarplugin-descriptor.properties复制到其他节点上scp -r ./ bigdata@node2:/home/elasticsearch-2.2.0/plugins/ik/
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  elasticsearch Hadoop HBASE