zoukankan      html  css  js  c++  java
  • hadoop2-elasticsearch的安装

    本文主要讲elasticsearch-2.2.1的安装过程。

    准备工作:

    1.搭建虚拟机

    你需要先参考

    hadoop2集群环境搭建

    把你的虚拟机搭建起来-hadoop环境可以先不用搭建(完成步骤1到步骤8

    2.下载elasticsearch包

    下载elasticsearch-2.2.1.tar.zip

    这里我搭建的是4台虚拟机(node1,node2,node3,node4)

    elasticsearch 只允许普通用户操作,不允许root用户操作

    --1.关闭防火墙
    service iptables stop
    
    --2.创建用户elsearch
    useradd elsearch
    --3.给用户elsearch设置密码
    passwd elsearch
    
    --4.在/opt目录下面创建elsearch/es/目录
    mkdir /opt/elsearch/es/
    
    --5.进入到/opt目录下面
    cd /opt/
    
    --6.把elsearch目录以及里面的子目录的权限设置为elsearch
    chown -R elsearch:elsearch elsearch
    
    --此时,/elsearch, /elsearch/es的权限都应该为elsearch
    
    --7.切换用户到elsearch
    su elsearch

    此时,所有节点都应该是elsearch用户,而不是root用户。

    现在去到node1节点上面进行操作

    --此时,在node1上面操作
    --1.此时,我们就可以把下载好的elasticsearch-2.2.1.tar.zip文件上传到node1下面的/opt/elsearch/es/
    --2.解压/opt/elsearch/es/elasticsearch-2.2.1.tar.zip文件
    cd /opt/elsearch/es/
    unzip elasticsearch-2.2.1.tar.zip
    
    --3.修改配置文件
    cd /opt/elsearch/es/elasticsearch-2.2.1/conf/
    
    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: elsearch-app
    #
    # ------------------------------------ Node ------------------------------------
    #
    # Use a descriptive name for the node:
    #
    node.name: node1
    #
    # 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:
    #
    # ----------------------------------- 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.79.138
    #
    # 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.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
    #
    # For more information, see the documentation at:
    # <http://www.elastic.co/guide/en/elasticsearch/reference/current/modules-discovery.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>
    #
    # ---------------------------------- 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
    discovery.zen.ping.multicast.enabled: false
    discovery.zen.ping.unicast.hosts: ["192.168.79.138","192.168.79.139", "192.168.79.140","192.168.79.141"]
    discovery.zen.ping_timeout: 120s
    client.transport.ping_timeout: 60s
    
    
    
    :wq
    
    
    --4.然后从node1分发到其他节点(node2, node3, node4)的相同目录
    cd /opt/elsearch/es
    scp -r ./elasticsearch-2.2.1 elsearch@node2:/opt/elsearch/es
    scp -r ./elasticsearch-2.2.1 elsearch@node3:/opt/elsearch/es
    scp -r ./elasticsearch-2.2.1 elsearch@node4:/opt/elsearch/es

    接下来在node2,node3,node4上面进行操作

    --分别修改node2,node3,node4上面的配置文件
    cd /opt/elsearch/es/elasticsearch-2.2.1/conf/
    
    vi elasticsearch.yml
    
    --修改两个地方
    --1.node.name: node1
    --2.network.host: 192.168.79.138
    
    --修改为和下面相对应,然后保存
    192.168.79.138 node1
    192.168.79.139 node2
    192.168.79.140 node3
    192.168.79.141 node4

    最后,在所有节点(node1,node2,node3,node4)上面进行操作

    --启动elasticsearch
    cd /opt/elsearch/es/elasticsearch-2.2.1/bin
    ./elasticsearch

    打开浏览器,输入:node1:9200可以看见一下效果

    添加插件elasticsearch-head

    下载elasticsearch-head

    把下载好的插件重命名为

    head

    然后添加到所有节点(node1,node2,node3,node4)的

    /opt/elsearch/es/elasticsearch-2.2.1/plugins

    目录。

    然后重启所有节点。

    --启动elasticsearch
    cd /opt/elsearch/es/elasticsearch-2.2.1/bin
    ./elasticsearch

    效果如下:

    了解更多:elasticsearch-head

    ========================================================

    More reading,and english is important.

    I'm Hongten

     

    大哥哥大姐姐,觉得有用打赏点哦!你的支持是我最大的动力。谢谢。
    Hongten博客排名在100名以内。粉丝过千。
    Hongten出品,必是精品。

    E | hongtenzone@foxmail.com  B | http://www.cnblogs.com/hongten

    ======================================================== 

  • 相关阅读:
    javascript中new Date()的浏览器兼容性问题
    js 时间格式化
    HTML5 JS实现搜索匹配功能
    PHP中preg_match正则匹配的/u /i /s是什么意思
    微信开放接口获取用户昵称保存到MySQL中为空白
    linux下源码安装软件
    格式化MYSQL时间戳函数FROM_UNIXTIME
    Zabbix-proxy安装部署
    使用ss命令对tcp连接数和状态的监控性能优化
    Zabbix使用netstat监控会话
  • 原文地址:https://www.cnblogs.com/hongten/p/hongten_hadoop_elastic_search.html
Copyright © 2011-2022 走看看