ElasticSearch-7.4.2集群安装指南-包含ik/pinyin/jieba插件

ElasticSearch-7.4.2集群安装指南

备注:
1- 安装ElasticSearch不建议使用root账号,下文均按照账号为duser来介绍;
2- 该版本配置了账号密码;

1、下载编译好的ES安装包

本安装包,包括已经编译好的:ik / pinyin / jieba插件;
别的不同版本的结巴插件,可以访问该链接
上述链接下载的jieba安装包需要编译,编译过程参考:
Elasticsearch 中文分词 - 结巴分词
centos7系统下elasticsearch7.5.1集群安装elasticsearch-jieba-plugin 7.4.2 和analysis-kuromoji 日语分词器…

— es安装插件 —

【如果使用第一个链接下载的安装包可忽略】

analysis-ik

./bin/elasticsearch-plugin install https://github.com/medcl/elasticsearch-analysis-ik/releases/download/v7.4.2/elasticsearch-analysis-ik-7.4.2.zip

pinyin

./bin/elasticsearch-plugin install https://github.com/medcl/elasticsearch-analysis-pinyin/releases/download/v7.4.2/elasticsearch-analysis-pinyin-7.4.2.zip

jieba

  1. 安装gradle: wget https://services.gradle.org/distributions/gradle-6.3-bin.zip
  2. 配置环境变量:
    vim ~/.bash_profile
    export GRADLE_HOME=/your path/gradle-6.3/
    export PATH=$GRADLE_HOME/bin:$PATH
    source ~/.bash_profile
  3. 下载jieba插件:https://github.com/sing1ee/elasticsearch-jieba-plugin/tree/v7.4.2/elasticsearch-jieba-plugin-7.4.2.zip
  4. 解压下载的elasticsearch-jieba-plugin-7.4.2.tar.gz插件,进入文件夹
    cd elasticsearch-jieba-plugin-7.4.2
  5. 编译:gradle pz
  6. 进入编译生成的文件夹:cd build/distributions/
  7. 把生成的压缩包elasticsearch-jieba-plugin-7.4.2.zip,拷贝到你自己的es的plugins文件夹下
  8. 之后解压:unzip elasticsearch-jieba-plugin-7.4.2.zip -d analysis-jieba
  9. 删除压缩包: rm elasticsearch-jieba-plugin-7.4.2.zip
    至此,相关插件已经准备完毕,可开始其他相关配置;
2、系统配置 使用root账号配置
  1. 文件句柄数量和线程数、内存锁定
	su root
    vi /etc/security/limits.conf
# add the follows to the end of file
*      soft    nofile    65536
*      hard    nofile    65536
*      soft    nproc     4096
*      hard    nproc     4096
duser  soft    memlock   unlimited
duser  hard    memlock   unlimited
  1. 配置虚拟内存
su root
vi /etc/sysctl.conf
# add the follow line to the end to file
vm.max_map_count=655360
# make the configuration take effect
sysctl -p
3、elasticsearch.yml 配置修改
cd elasticsearch-7.4.2/config/
vi elasticsearch.yml

修改参数如下:

cluster.name: 你的集群名称
node.name: 该节点的名称
node.master : true  # 是否可参与master节点选举
node.data : true  # 是否作为数据节点
# 索引数据存放路径(建议放在较大磁盘分区)
# 注意事项,在配置索引数据路径时,须确保duser账户拥有文件夹的读写权限,通常可通过[chown -R duser:duser path_to_data]的方式配置
path.data: /你的实际安装路径/elasticsearch-7.4.2/data
path.logs: /你的实际安装路径/elasticsearch-7.4.2/logs
network.host: 0.0.0.0  # 节点访问host,建议配置为本机ip
http.port: 9234  # 外部暴露端口
discovery.seed_hosts: ["ip1:9300", "ip2:9300", "ip:9300"]  # 集群发现设定,建议列表写入所有节点ip,其中9300为集群内部各节点间互相访问的端口
# 集群选主策略,设为(n/2)+1, eg: 3个节点,设为2; 4个节点,设为3; 5个节点,设为3;为防止脑裂,建议集群为2个节点以上
cluster.initial_master_nodes: ["ip1", "ip2","ip3"]
discovery.zen.ping_timeout: 120s
client.transport.ping_timeout: 60s
4、jvm.yml 配置修改
# jvm内存配置,将Xms(最小)与Xmx(最大)设为相同值
# jvm内存配置,根据机器设定,如果机器仅运行elasticsearch,可考虑设为总内存的75%,eg: 16G,设为12G;
# jvm内存配置,elasticsearch使用内存存在上限,最大可设为31G
-Xms4g
-Xmx4g
5、elasticsearch 启动

进入elasticsearch-7.4.2主目录下,执行nohup ./bin/elasticsearch &后台启动elasticsearch进程

6、elasticsearch-7.4.2 权限相关操作指令
  1. 进入elasticsearch-7.4.2主目录,执行下面指令创建管理员账号:
    ./bin/elasticsearch-users useradd my_admin -p my_password -r superuser
    添加完用户,需要重启es才可以生效
  2. 删除用户指令为:./bin/elasticsearch-users userdel my_admin
  3. 使用管理员账号修改普通账号密码指令:
curl -u my_admin:my_password -XPUT 'http://ip:9234/_xpack/security/user/elastic/_password?pretty' -H 'Content-Type: application/json' -d'{"password”:"new_pass"}'

该操作需要等集群状态正常后才可以生效
4. 确认密码是否正确指令

curl -u my_admin:my_password 'http://ip:9234/_xpack/security/_authenticate?pretty'
  1. 查看集群状态:curl -u my_admin:my_password 'ip:9234'

先这么多吧,后续发现问题继续补充

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值