elasticsearch环境搭建过程

1. 安装java
    $ apt-get update
    $ apt-get upgrade
    $ apt-get install python-software-properties
    $ apt-get install software-properties-common
    $ add-apt-repository ppa:webupd8team/java
    $ apt-get update
    $ apt-get upgrade
    $ apt-get install oracle-java7-installer
    $ apt-get update
    $ apt-get upgrade
2. 下载需要的版本的elasticsearch
    $ wget https://download.elastic.co/elasticsearch/elasticsearch/elasticsearch-1.5.2.tar.gz
    $ cp elasticsearch-1.5.2.tar.gz /usr/share/
    $ tar -zxvf elasticsearch-1.5.2.tar.gz
    $ mv elasticsearch-1.5.2 elasticsearch
    $ cd elasticsearch/bin
    $ ./elasticsearch -d    #后台启动
    $ ./elasticsearch       #前台启动
3. 加入系统服务
    $ sudo update-rc.d elasticsearch defaults 95 1
    $ /etc/init.d/elasticsearch start
4. 查看服务是否已经成功启动
    打开 http://es服务器IP:9200 看页面 举例:http://127.0.0.1:9200
5. 安装实用插件
        $ cd elasticsearch/plugin/
        $ ./plugin -i lmenezes/elasticsearch-kopf/      #安装kopf,查看es数据状态 http://127.0.0.1:9200/_plugin/kopf

        $ ./plugin -i mobz/elasticsearch-head           #安装head,查看数据内容   http://127.0.0.1:9200/_plugin/head

        $ ./plugin -install river-csv -url https://github.com/AgileWorksOrg/elasticsearch-river-csv/releases/download/2.2.1/elasticsearch-river-csv-2.2.1.zip               
          #安装csv插件,用于导入csv格式数据
          #github: https://github.com/AgileWorksOrg/elasticsearch-river-csv

        $ ./plugin -i jdbc --url http://xbib.org/repository/org/xbib/elasticsearch/plugin/elasticsearch-river-jdbc/1.5.0.5/elasticsearch-river-jdbc-1.5.0.5-plugin.zip      
          #安装jdbc

        #安装MySQL JDBC driver
        $ curl -o mysql-connector-java-5.1.33.zip -L 'http://dev.mysql.com/get/Downloads/Connector-J/mysql-connector-java-5.1.33.zip/from/http://cdn.mysql.com/'
        $ unzip mysql-connector-java-5.1.33.zip
        $ cd mysql-connector-java-5.1.33
        $ cp mysql-connector-java-5.1.33-bin.jar /usr/share/elasticsearch/plugins/jdbc
        $ chmod 644 /usr/share/elasticsearch/plugins/jdbc
6. 卸载插件
    ./plugin -remove river-mongodb  #卸载river-mongodb
7. 根据需求修改配置
    (1)elasticsearch/bin/elasticsearch.in.sh,将内存最大值和最小值设置成相同的(如果内存64G,可设置30G,最大不能超过32G)
        if [ "x$ES_MIN_MEM" = "x" ]; then
            ES_MIN_MEM=30g
        fi
        if [ "x$ES_MAX_MEM" = "x" ]; then
            ES_MAX_MEM=30g
        fi

    (2)elasticsearch/config/elasticsearch.yml,修改如下参数
        cluster.name: shenfengbkup #修改此处参数,默认elasticsearch,避免内网下存在相同集群名
        http.port: 9200 #可选修改
        index.number_of_replicas: 0  #分片副本数,可修改为0,默认为1,可选修改
        index.number_of_shards: 5   #分片数,默认为5 ,若index数据量不大可修改为1

        在最后添加:
            http.cors.enabled: true
            http.cors.allow-origin: "/.*/"
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

  • Spring Boot 参考指南 介绍 转载自:https://www.gitbook.com/book/qbgb...
    毛宇鹏阅读 47,126评论 6 342
  • Spring Cloud为开发人员提供了快速构建分布式系统中一些常见模式的工具(例如配置管理,服务发现,断路器,智...
    卡卡罗2017阅读 135,975评论 19 139
  • Android 自定义View的各种姿势1 Activity的显示之ViewRootImpl详解 Activity...
    passiontim阅读 176,037评论 25 709
  • 家有七旬老者,善谈养生之道,如今记录到简书,感触自己的同时,也希望能给您带来一丝感悟。 最好的医生是自己 “善恶随...
    寒风81阅读 1,567评论 2 1
  • 文|小砚某 那时候还小,十一二岁的年纪,不怎么懂事,却也喜欢穿着漂亮的新衣服,抱着可爱的洋娃娃。 那年秋天,天气转...
    小砚某阅读 3,987评论 4 3

友情链接更多精彩内容