• es-02-elasticsearch安装及遇到的问题


    最近因为工作需要, 又使用到了es, 版本已经从当年的2.4 更新到了6.3

    基本上解压即用, 

    elasticsearch 5.x 版本, 在 centos6下, 很多性能不能够发挥, 建议 centos 7+ 使用, 需要jdk1.8+

    1, es

    修改配置文件, 注意, 不能使用root用户

    集群通过cluster.name进行发现

    [root@10-110-122-172 config]# cat elasticsearch.yml | grep -v ^# | grep  -v ^$
    cluster.name: my-es
    node.name: node-1
    path.data: /data/elastic/data
    path.logs: /data/elastic/logs
    network.host: 10.110.122.172
    http.port: 9200
    bootstrap.system_call_filter: false
    ## 非常重要, 防脑裂配置, 服务发现, 哪些可以成为 master
    discovery.zen.ping.unicast.hosts: ["node1", "node2", "node3"]
    ## 有权利成为master的数量,
    discovery.zen.minimum_master_nodes:3

    分发, 并且分别启动

    ./bin/elasticsearch &

    后台启动

    ./bin/elasticsearch -d -p pid

    使用nohup启动不了, 原因未寻找

    nohup ./bin/elasticsearch 1>/dev/null 2>&1 &

    停止

    kill -SIGTERM 15516

    可能会出错, 需要修改kernel的内容

    https://github.com/DimonHo/DH_Note/issues/3

    1), vi /etc/security/limits.conf

    用户可创建文件数太少

    * soft nofile 65536
    * hard nofile 131072
    * soft nproc 2048
    * hard nproc 4096

    查看: ulimit -Hn

    2), vi /etc/security/limits.d/90-nproc.conf

    * soft nproc 2048

    3), vi /etc/sysctl.conf

    虚拟内存大小

    vm.max_map_count=655360

    查看: sudo sysctl -p

    线上环境安装es需要注意的问题: 

    https://www.elastic.co/guide/cn/kibana/current/production.html

    2, docker 启动 elasticsearch

    未实验..

    1), pull

    docker pull docker.elastic.co/elasticsearch/elasticsearch:6.3.1

    2), 启动

    docker run -p 9200:9200 -p 9300:9300 -e "discovery.type=single-node" docker.elastic.co/elasticsearch/elasticsearch:6.3.1

    4, 使用docker-compose 启动集群

    version: '2.2'
    services:
      elasticsearch:
        image: docker.elastic.co/elasticsearch/elasticsearch:6.3.1
        container_name: elasticsearch
        environment:
          - cluster.name=docker-cluster
          - bootstrap.memory_lock=true
          - "ES_JAVA_OPTS=-Xms512m -Xmx512m"
        ulimits:
          memlock:
            soft: -1
            hard: -1
        volumes:
          - esdata1:/usr/share/elasticsearch/data
        ports:
          - 9200:9200
        networks:
          - esnet
      elasticsearch2:
        image: docker.elastic.co/elasticsearch/elasticsearch:6.3.1
        container_name: elasticsearch2
        environment:
          - cluster.name=docker-cluster
          - bootstrap.memory_lock=true
          - "ES_JAVA_OPTS=-Xms512m -Xmx512m"
          - "discovery.zen.ping.unicast.hosts=elasticsearch"
        ulimits:
          memlock:
            soft: -1
            hard: -1
        volumes:
          - esdata2:/usr/share/elasticsearch/data
        networks:
          - esnet
    
    volumes:
      esdata1:
        driver: local
      esdata2:
        driver: local
    
    networks:
      esnet:

    启动

    docker-compose up

    遇到的问题:  https://github.com/DimonHo/DH_Note/issues/3

  • 相关阅读:
    perl 升级到5.20版本
    perl 升级到5.20版本
    Group Commit of Binary Log
    Group Commit of Binary Log
    docker exec 运行命令
    docker exec 运行命令
    mysql timestamp 值不合法问题
    mysql timestamp 值不合法问题
    ulimit 说明
    /etc/security/limits.conf 配置
  • 原文地址:https://www.cnblogs.com/wenbronk/p/9354702.html
Copyright © 2020-2023  润新知