zoukankan      html  css  js  c++  java
  • elastic安装,简单配置

    安装elasticsearch:

    # 下载安装包
    wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.2.0-darwin-x86_64.tar.gz
    # 解压es
    tar -xzf elasticsearch-7.2.0-darwin-x86_64.tar.gz
    # 修改目录
    mv elasticsearch-7.2.0 /usr/local/
    # 创建软连接
    ln -s /usr/local/elasticsearch-7.2.0 /usr/local/elasticsearch
    # 创建es执行用户
    useradd es
    # 修改目录 权限
    chown -R es:es /usr/local/elasticsearch-7.2.0
    chown -R es:es /usr/local/elasticsearch
    

    修改elasticsearch配置:

    • 修改配置文件:config/elasticsearch.yml
    # ---------------------------------- Cluster -----------------------------------
    # Use a descriptive name for your cluster:
    cluster.name: qx-car
    # ------------------------------------ Node ------------------------------------
    # Use a descriptive name for the node:
    node.name: node-1
    # ----------------------------------- Paths ------------------------------------
    # Path to directory where to store the data (separate multiple locations by comma):
    path.data: /data/service/elasticsearch
    # Path to log files:
    path.logs: /data/logs/elasticsearch
    # ----------------------------------- Memory -----------------------------------
    # Lock the memory on startup:
    bootstrap.memory_lock: true
    # ---------------------------------- Network -----------------------------------
    # Set the bind address to a specific IP (IPv4 or IPv6):
    network.host: 172.18.63.171
    # Set a custom port for HTTP:
    http.port: 9200
    # --------------------------------- Discovery ----------------------------------
    # Bootstrap the cluster using an initial set of master-eligible nodes:
    cluster.initial_master_nodes: ["node-1"]
    
    • 修改配置文件:config/jvm.options
    # 内存修改
    -Xms16g
    -Xmx16g
    
    • 创建目录
    # 创建 data目录
    mkdir /data/service/elasticsearch
    # 创建 log目录
    mkdir /data/logs/elasticsearch
    # 修改目录权限
    chown -R es:es /data/service/elasticsearch
    chown -R es:es /data/logs/elasticsearch
    

    修改系统配置:

    #  关闭交换分区,防止内存置换降低性能。 将/etc/fstab 文件中包含swap的行注释掉
    sed -i '/swap/s/^/#/' /etc/fstab
    swapoff -a
    # 单用户可以打开的最大文件数量,可以设置为官方推荐的65536或更大些
    echo "* - nofile 655360" >> /etc/security/limits.conf
    # 单用户线程数调大
    echo "* - nproc 131072" >> /etc/security/limits.conf
    # 设置es内存锁无限制
    echo "es soft memlock unlimited" >> /etc/security/limits.conf
    echo "es hard memlock unlimited" >> /etc/security/limits.conf
    # 单进程可以使用的最大map内存区域数量
    echo "vm.max_map_count = 655360" >> /etc/sysctl.conf
    # 参数修改立即生效
    sysctl -p
    

    启动与关闭:

    # 切换账号
    su es
    # 启动es
    /usr/local/elasticsearch/bin/elasticsearch -d -p pid
    # 关闭es
    pkill -F /usr/local/elasticsearch/pid
    

    参考文章:

  • 相关阅读:
    人月神话2
    cJson 常见用法
    Python C扩展
    动态链接--运行时加载dlopen
    mtrace 简介
    Linux coredump
    动态链接--so的搜索过程
    线程同步--条件变量
    编译过程学习
    Linux 信号
  • 原文地址:https://www.cnblogs.com/iamdoufu/p/11303601.html
Copyright © 2011-2022 走看看