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集群部署和运维命令的更多相关文章

  1. Elasticsearch学习总结 (Centos7下Elasticsearch集群部署记录)

    一.  ElasticSearch简单介绍 ElasticSearch是一个基于Lucene的搜索服务器.它提供了一个分布式多用户能力的全文搜索引擎,基于RESTful web接口.Elasticse ...

  2. hadoop记录-hadoop集群日常运维命令

    hadoop集群日常运维命令 #1.namenode hadoop namenode -format #格式化,慎用 su hdfs hadoop-daemon.sh start namenode h ...

  3. 我的ElasticSearch集群部署总结--大数据搜索引擎你不得不知

    摘要:世上有三类书籍:1.介绍知识,2.阐述理论,3.工具书:世间也存在两类知识:1.技术,2.思想.以下是我在部署ElasticSearch集群时的经验总结,它们大体属于第一类知识“techknow ...

  4. Linux中Elasticsearch集群部署

    1.下载安装包elasticsearch-6.3.1  安装包自己下载,网上很多 2.安装位置在cd /usr/local/elasticsearch/目录下 3.因为ES使用root权限运行会报错, ...

  5. HBase集群部署与基础命令

    HBase 集群部署 安装 hbase 之前需要先搭建好 hadoop 集群和 zookeeper 集群.hadoop 集群搭建可以参考:https://www.cnblogs.com/javammc ...

  6. ES之四、Elasticsearch集群和索引常用命令

    REST API用途 elasticsearch支持多种通讯,其中包括http请求响应服务,因此通过curl命令,可以发送http请求,并得到json返回内容. ES提供了很多全面的API,常用的RE ...

  7. elasticsearch集群部署

    启动elk: zjtest7-redis:/usr/local/elasticsearch-2.3.4/bin# ./elasticsearch -d 后台运行 访问: http://192.168. ...

  8. Elasticsearch集群和索引常用命令

    https://www.cnblogs.com/pilihaotian/p/5846173.html REST API用途 ES提供了很多全面的API,大致可以分成如下几种: 1 检查集群.节点.索引 ...

  9. elasticsearch集群部署以及head插件安装

    环境准备 elasticsearch是Java程序写的因此必须装jdk,否则使用不了. [root@openstack ~]# java -versionopenjdk version "1 ...

  10. Kubernetes集群部署及简单命令行操作

    三个阶段部署docker:https://www.cnblogs.com/rdchenxi/p/10381631.html 环境准备 [root@master ~]# hostnamectl set- ...

随机推荐

  1. js开发环境如何解决跨域问题

    问题 npm start之后,自己会启动一个端口,比如3000,调用后端服务(比如localhsot:3006/service/list)就会出现跨域,那怎么弄呢? 方式一: webpack设置pro ...

  2. mysql错误号码2003 can't connect to mysql server on 'localhost' (0)解决方案

    找到mysql安装目录下的Bin目录,在cmd中进入这个目录,运行net start mysql 却显示服务名无效 所以此时 首先在MYSQL的安装目录bin下,输入mysqld --install ...

  3. 运行springboot的时候访问本地图片地址的问题

    @Configuration public class MyConfigrauration implements WebMvcConfigurer { /** * 当有请求经过[/myUpload/* ...

  4. QML笔记

    文章钢要: 1.qml基础知识 2.qml语言技巧 一.QML basic types QML Language提供的基础类型:int ,bool,string,double,real,var,url ...

  5. matlab简单区间列频数统计输出

    最近的一个作业要有这个输出计算,直接拿来用的函数没怎么找到,合计着就编一个吧,没多少时间仔细编,但能用. 程序支持:Matlab2019b,以往的版本应该也能用. function [d,zb1,ps ...

  6. vdom diff

    其实diff的核心在于两点: 比对(diff的运算过程) 修改(diff的返回结果,输出生成的patch并操作) 树的BFS(广度优先遍历)/DFS(深度优先遍历),需要O(N)的时空复杂度 传统di ...

  7. nodejs,阿里云手机号一键登录

    const Core = require('@alicloud/pop-core'); const accessKeyId = "xxxx" const accessSecret ...

  8. 第九章:用Python处理省份城市编码数据

    文章目录 项目背景 项目代码 新增省份编码 获取编码映射数据 合并数据 统计省份用户数 使用SQL实现 源码地址 本文可以学习到以下内容: 免费获取全国省份.城市编码以及经纬度数 使用 pandas ...

  9. java方法的笔记

    方法 方法的概念 方法(method)是将具有独立功能的代码块组织成为一个整体,使其具有特殊功能的代码集 注意: 方法必须先创建才可以使用,该过程成为方法定义 方法创建后并不是直接可以运行的,需要手动 ...

  10. C++和C中的输入输出总结、标准输入/标准输出/标准错误与重定向,>>、>、<、<<

    标准输入/标准输出/标准错误与重定向 0表示标准输入.1表示标准输出.2标准错误.1和2都是默认是输出到屏幕. linux中的>>.>.<.<<:这些符号是Linu ...