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
    评论
Elasticsearch是一个基于Lucene的搜索服务器,提供分布式多用户能力的全文搜索引擎,支持RESTful接口,我们可以使用它来进行数据的存储、检索和分析等操作。下面是ElasticSearch2.4.6的安装部署以及集群部署、ElasticSearch-head等件的安装。 ## 安装部署 ### 1. 下载ElasticSearch2.4.6 从官网下载ElasticSearch2.4.6:https://www.elastic.co/downloads/past-releases/elasticsearch-2-4-6 ### 2. 解压缩 将下载好的文件解压缩到指定目录: ``` tar -xzvf elasticsearch-2.4.6.tar.gz -C /usr/local/ ``` ### 3. 修改配置文件 修改`/usr/local/elasticsearch-2.4.6/config/elasticsearch.yml`文件,主要修改以下几项: ``` cluster.name: my-elasticsearch-cluster node.name: my-elasticsearch-node-1 network.host: 0.0.0.0 http.port: 9200 ``` 其中`cluster.name`表示集群名称,`node.name`表示节点名称,`network.host`表示绑定的IP地址,`http.port`表示http监听端口。 ### 4. 启动ElasticSearch 运行以下命令启动Elasticsearch: ``` cd /usr/local/elasticsearch-2.4.6/bin/ ./elasticsearch ``` ### 5. 验证安装 使用浏览器访问`http://localhost:9200/`,如果返回以下信息则表示安装成功: ``` { "name" : "my-elasticsearch-node-1", "cluster_name" : "my-elasticsearch-cluster", "version" : { "number" : "2.4.6", "build_hash" : "5376dca9f70f3abef96a77f4bb22720ace8240fd", "build_timestamp" : "2017-07-18T12:17:44Z", "build_snapshot" : false, "lucene_version" : "5.5.4" }, "tagline" : "You Know, for Search" } ``` ## 集群部署 ### 1. 修改配置文件 在每个节点的`/usr/local/elasticsearch-2.4.6/config/elasticsearch.yml`文件中添加以下内容: ``` cluster.name: my-elasticsearch-cluster node.name: my-elasticsearch-node-1 network.host: 0.0.0.0 http.port: 9200 discovery.zen.ping.unicast.hosts: ["192.168.1.101", "192.168.1.102", "192.168.1.103"] ``` 其中`discovery.zen.ping.unicast.hosts`表示集群中所有节点的IP地址列表。 ### 2. 启动节点 分别在每个节点上启动Elasticsearch: ``` cd /usr/local/elasticsearch-2.4.6/bin/ ./elasticsearch ``` ### 3. 验证集群 使用浏览器访问`http://localhost:9200/_cat/nodes?v`,如果返回以下信息则表示集群启动成功: ``` ip heap.percent ram.percent cpu load_1m load_5m load_15m node.role master name 192.168.1.101 34 98 3 0.00 0.01 0.05 mdi * my-elasticsearch-node-1 192.168.1.102 36 99 0 0.00 0.01 0.05 mdi - my-elasticsearch-node-2 192.168.1.103 31 98 2 0.00 0.01 0.05 mdi - my-elasticsearch-node-3 ``` ## ElasticSearch-head等件的安装 ### 1. 安装Node.js和npm ElasticSearch-head是一个基于浏览器的Elasticsearch集群管理工具,需要安装Node.js和npm才能使用。使用以下命令安装Node.js和npm: ``` sudo apt-get update sudo apt-get install nodejs npm ``` ### 2. 安装ElasticSearch-head 使用以下命令安装ElasticSearch-head: ``` sudo npm install -g grunt-cli git clone git://github.com/mobz/elasticsearch-head.git cd elasticsearch-head npm install ``` ### 3. 启动ElasticSearch-head 使用以下命令启动ElasticSearch-head: ``` grunt server & ``` 打开浏览器,访问`http://localhost:9100/`,即可打开ElasticSearch-head界面。 至此,ElasticSearch2.4.6的安装部署以及集群部署、ElasticSearch-head等件的安装完成。

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值