雷兽,我的哔哩哔哩直播间https://live.bilibili.com/23575114

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

 

下载安装 都是最简单的 es本什不依赖其他任何比如zk那样的东西

并且官方有提供rpm包 很方便的 所以下载等事宜就不多说了

去https://www.elastic.co/cn/downloads即可

 

这里说一下用yum 主要是centos里的软件源来安装(所有elastic公司elk系列的都能用这个方式安装)

sudo rpm --import https://packages.elastic.co/GPG-KEY-elasticsearch
在/etc/yum.repos.d/下建立:
vi elastic.repo
[elastic-5.x]
name=Elastic repository for 5.x packages
baseurl=https://artifacts.elastic.co/packages/5.x/yum
gpgcheck=1
gpgkey=https://artifacts.elastic.co/GPG-KEY-elasticsearch
enabled=1
autorefresh=1
type=rpm-md

wq
保存

sudo yum makecache
sudo yum install elasticsearch

es配置文件如下

elasticsearch.yml

一般在/etc/elasticsearch下

cluster.name: es-elk
node.name: node-2
path.data: /es/data
path.logs: /es/logs
network.host: es2
http.port: 9200
node.master: true
node.data: true
http.enabled: true
http.cors.enabled: true
http.cors.allow-origin: "*"
discovery.zen.ping.unicast.hosts: ["es1","es2","es3","es4","es5","es6"]
discovery.zen.minimum_master_nodes: 1

 

network.host和discovery.zen.ping.unicast.hosts是主机名、域名或者ip,主机名可以在/etc/hosts里配置

相关目录新建  就不说了

chown -R elasticsearch:elasticsearch /es 

设定目录权限

集群注意node.name network.host  这里我用了域名\主机名 要修改/etc/hosts

集群搭建如果起不来 删除data目录下的节点信息  node 还是nodes   再重启就行了(包括很多配置修改后都得删这个,不过注意!!!!这是没数据的情况下)

vi /etc/elasticsearch/jvm.options

按照系统内存(最好是评估一下可以利用的内存)来设置下面两项(就是Xms和Xmx)

# Xms represents the initial size of total heap space
# Xmx represents the maximum size of total heap space

-Xms3000m
-Xmx3000m

 

rpm包安装的话 可以用 service start那套系统服务管理命令来开始服务

centos7里是

启动:systemctl start elasticsearch 

常驻:systemctl enable elasticsearch 

 

centos6是

启动: service elasticsearch start

常驻:

chkconfig --add elasticsearch

chkconfig elasticsearch on

 

附一些es的基本url:

es里有哪些索引

http://任一节点ip:9200/_cat/indices?v

 

es集群状态(单节点"status" 必然是"yellow",是正常的,多节点应该是green,如果是多节点是yellow的话,那是有index没有完整的2备份以上,green的意思就是集群里的所有数据都有两个经过校验的备份可用,即数据集处于冗余状态,yellow就是数据是全的,单是没有数据冗余)

http://任一节点ip:9200/_cluster/health?pretty

 

es集群里所有索引的数据片情况,包括数据片在哪些节点上

http://任一节点ip:9200/_cat/shards 当前数据片状态

posted on 2017-02-08 10:50  雷兽  阅读(176)  评论(0编辑  收藏  举报