Elasticsearch集群部署和运维命令
Elasticsearch集群部署
下载tar包
在"https://www.elastic.co/cn/downloads/elasticsearch"页面,有 past releases,可以下载以前版本
下载
# wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.4.0-linux-x86_64.tar.gz
解压
# tar -zxvf elasticsearch-7.4.0-linux-x86_64.tar.gz -C /usr/local/
编辑配置系统参数
# vi /etc/sysctl.conf
vm.max_map_count=262144
# /sbin/sysctl -p --立即生效
# vi /etc/security/limits.conf
* soft nproc 65535
* hard nproc 65535
* soft nofile 65535
* hard nofile 131072
编辑配置文件
# cd elasticsearch-7.4.0/
# vi elasticsearch.yml
cluster.name: cluster-233
node.name: node_233_101
network.host: 10.233.27.103
network.publish_host: 10.233.27.103
http.port: 9500
transport.tcp.port: 9501
node.master: true
node.data: true
path.data: /usr/local/elasticsearch-7.4.0/data
path.logs: /usr/local/elasticsearch-7.4.0/logs
path.repo: ["/usr/local/elasticsearch-7.4.0/reposity"]
# head 插件需要这打开这两个配置
http.cors.allow-origin: "*"
http.cors.enabled: true
http.cors.allow-methods: OPTIONS, HEAD, GET, POST, PUT, DELETE
http.cors.allow-headers: "X-Requested-With, Content-Type, Content-Length, X-User"
http.max_content_length: 200mb
# 可以选举的主节点
cluster.initial_master_nodes: ["10.233.27.101","10.233.27.103","10.233.27.104"]
discovery.seed_hosts: ["10.233.27.101","10.233.27.103","10.233.27.104"]
gateway.recover_after_nodes: 2
network.tcp.keep_alive: true
network.tcp.no_delay: true
transport.tcp.compress: true
#集群内同时启动的数据任务个数,默认是2个
cluster.routing.allocation.cluster_concurrent_rebalance: 16
#添加或删除节点及负载均衡时并发恢复的线程个数,默认4个
cluster.routing.allocation.node_concurrent_recoveries: 16
#初始化数据恢复时,并发恢复线程的个数,默认4个
cluster.routing.allocation.node_initial_primaries_recoveries: 16
bootstrap.system_call_filter: false
### 没有节点都配置,node_name、network-host、network.public_host每个节点修改对应的IP
vi jvm.options
-Xms1g #修改成想要的值
-Xmx1g #修改成想要的值
建elastic用户
# useradd elastic ### 设置elasticsearch安装目录属主为elastic
# chown -R elastic.elastic elasticsearch-7.4.0
启动elasticsearch
用elastic用户登录
# su - elastic 启动elasticsearch,加-d用守护进程启动
# /usr/local/elasticsearch-7.4.0/bin/elasticsearch -d
查看es状态信息
查看集群健康状态
# curl -XGET "http://10.2.XX.XX:9200/_cluster/health?pretty"
* "status" : "green"代表健康,"yellow"代表主分片正常副分片不正常,"red"代表主分片不正常 查看集群节点信息
# curl -XGET "http://10.2.2.1:9200/_cat/nodes?v&format=json&pretty"
* "master" : "*"为主节点,"-"为普通节点 索引信息
# curl -XGET "http://10.2.2.1:9200/_cat/indices?v"
* health索引健康状态,pri.store.size存储大小 索引信息[:shard]
# curl -XGET "http://10.2.2.1:9200/_cluster/health?pretty&level=indices"
* "number_of_shards" : 1把索引分为几个分片,"number_of_replicas" : 1每个主分片有几个副本,"unassigned_shards" : 0未分配的shard[磁盘85%或节点宕] 堆Jvm使用率
# curl -XGET "http://10.2.2.1:9200/_cat/nodes?v=true&h=name,node*,heap*"
* heap.current现使用量 heap.percent百分比 heap.max最大值 [索引-分片]在节点的分配情况
# curl -XGET "http://10.2.2.1:9200/_cat/shards?v=true&s=state" 检查分片分配_cluster/allocation/explain
### 提供检测,给出未分配分片的原因,已分配分片为什么没有rebalance或转移到别的节点的解释
# curl -XGET "http://10.3.4.1:9200/_cluster/allocation/explain?pretty" 对未分配的分片,重试分配
# curl -XPOST "http://10.3.4.1:9200/_cluster/reroute?retry_failed=true"
# curl -XGET "http://10.34.4.153:9200/_cluster/allocation/explain?pretty&filter_path=index,node_allocation_decisions.node_name,node_allocation_decisions.deciders.*" 手动分配分片
1)第一步,提取node 名称
curl -XGET 'http://10.34.4.153:9200/_nodes/process?pretty=true'
2)创建脚本,手动分配
#!/bin/bash
NODE="0gniN6q6S4GVuCXtWTRbwQ"
IFS=$'\n'
for line in $(curl -s 'http://10.34.4.153:9200/_cat/shards' | fgrep UNASSIGNED); do
INDEX=$(echo $line | (awk '{print $1}'))
SHARD=$(echo $line | (awk '{print $2}'))
echo $INDEX
echo $SHARD
curl -XPOST 'http://10.34.4.153:9200/_cluster/reroute' -H 'content-Type:application/json' -d '{
"commands": [
{
"allocate": {
"index": "'$INDEX'",
"shard": '$SHARD',
"node": "'$NODE'",
"allow_primary": true
}
}
]
}'
done
安装kibana
kibana作为es的客户端,进行操作;需要安装与es同一版本的包,否则不可用.
下载kibana包
# wget https://artifacts.elastic.co/downloads/kibana/kibana-7.4.0-linux-x86_64.tar.gz
解压
# tar -zxvf kibana-7.4.0-linux-x86_64.tar.gz -C /usr/local 配置文件
# vi /usr/local/kibana-7.4.0-linux-x86_64/config/kibana.yml
server.port: 5601
server.host: "10.23.2.1"
elasticsearch.hosts: ["http://10.23.2.101:9500","http://10.23.2.103:9500","http://10.23.2.104:9500"]
安装logstash
待续...
Elasticsearch集群部署和运维命令的更多相关文章
- Elasticsearch学习总结 (Centos7下Elasticsearch集群部署记录)
一. ElasticSearch简单介绍 ElasticSearch是一个基于Lucene的搜索服务器.它提供了一个分布式多用户能力的全文搜索引擎,基于RESTful web接口.Elasticse ...
- hadoop记录-hadoop集群日常运维命令
hadoop集群日常运维命令 #1.namenode hadoop namenode -format #格式化,慎用 su hdfs hadoop-daemon.sh start namenode h ...
- 我的ElasticSearch集群部署总结--大数据搜索引擎你不得不知
摘要:世上有三类书籍:1.介绍知识,2.阐述理论,3.工具书:世间也存在两类知识:1.技术,2.思想.以下是我在部署ElasticSearch集群时的经验总结,它们大体属于第一类知识“techknow ...
- Linux中Elasticsearch集群部署
1.下载安装包elasticsearch-6.3.1 安装包自己下载,网上很多 2.安装位置在cd /usr/local/elasticsearch/目录下 3.因为ES使用root权限运行会报错, ...
- HBase集群部署与基础命令
HBase 集群部署 安装 hbase 之前需要先搭建好 hadoop 集群和 zookeeper 集群.hadoop 集群搭建可以参考:https://www.cnblogs.com/javammc ...
- ES之四、Elasticsearch集群和索引常用命令
REST API用途 elasticsearch支持多种通讯,其中包括http请求响应服务,因此通过curl命令,可以发送http请求,并得到json返回内容. ES提供了很多全面的API,常用的RE ...
- elasticsearch集群部署
启动elk: zjtest7-redis:/usr/local/elasticsearch-2.3.4/bin# ./elasticsearch -d 后台运行 访问: http://192.168. ...
- Elasticsearch集群和索引常用命令
https://www.cnblogs.com/pilihaotian/p/5846173.html REST API用途 ES提供了很多全面的API,大致可以分成如下几种: 1 检查集群.节点.索引 ...
- elasticsearch集群部署以及head插件安装
环境准备 elasticsearch是Java程序写的因此必须装jdk,否则使用不了. [root@openstack ~]# java -versionopenjdk version "1 ...
- Kubernetes集群部署及简单命令行操作
三个阶段部署docker:https://www.cnblogs.com/rdchenxi/p/10381631.html 环境准备 [root@master ~]# hostnamectl set- ...
随机推荐
- ETCD 实现服务发现讲解
租约:具有时间有效期,键绑定到租约后,当租约到期失效,绑定到的租约的键也会被删除. 创建租约 etcdctl lease grant 600 lease 694d81f509b7940a grante ...
- Linux系统Shell脚本第一章:Shell脚本基础及时间同步
目录 一.Shell脚本基础 1.Shell作用 2.什么是Shell脚本及处理逻辑 3.shell脚本基本格式 4. shell脚本执行方式 5.实操演示 二.Shell脚本中的变量 1.变量的作用 ...
- js树搜索框查询所有匹配节点及父节点(纯js实现)
// 搜索框输入查询树节点(纯前台js) //name 搜索框输入的值: //wgObj.dwtreeDateAll 为树 的全量数据 // titleArr 与输入框匹配的节点数组 //arrTar ...
- springboot+Elasticsearch 复杂查询
以前没做过ES 里面的查询,第一次接触还是走了点弯路的. 就是这个字段你在ES 都不用模糊查的话,就可以设置 type = FieldType.Keyword,比如ID之类的. 一:建ES存储的实体 ...
- 胖AP组建小型企业WLAN
胖ap组网 无线路由器wrt配置 使用自动连接时,会从无线路由器第一个端口开始连接,但那是接入外网的端口,因此和二层交换机相连的线要手动更改一下,否则和交换机相连的设备无法dhcp获取ip 打开无线路 ...
- ENGG1310 Electricity and electronics P1.1 microelectronics & optoelectronics
课程内容笔记,自用,不涉及任何 assignment,exam 答案 Notes for self use, not included any assignments or exams 听说这节课内容 ...
- 利用Opencv+Python 实现二维码识别
pip3 install pyzbar 准备工作: 二维码图片,我这里直接打印在了一张A4纸上,或者直接在草料网站上生成 草料二维码生成器,存放在手机上进行显示.在安装条码扫描库的时候大家注意:z ...
- Linux下设置目录或文件可读写,但不可以删除权限
例如:现在/home目录下有 :目录 data 和 文件 test.txt (1)设置/home/test.txt可读写但是不可以删除命令(文件设置): sudo chattr +a /home/te ...
- [1] Multi-View Transformer for 3D Visual Grounding 论文精读
参考: https://zhuanlan.zhihu.com/p/467913475 3D Visual Grounding小白调研笔记 https://zhuanlan.zhihu.com/p/34 ...
- 前端之Vue day07 混入、插件、elementui、Router、Vuex
一.Props补充 1.父传子在子组件标签上起自定义属性 使用数组 就不演示了,太简单了 2.限制传入的数据类类型 使用对象 同样,展示过的 3.props补充 就是套对象,加以限制 props:{ ...