es的集群搭建及测试

在虚拟机的终端操作搭建集群
克隆虚拟机
修改2个虚拟机的主机名为a1和a2,ip为101和102
vi /etc/hostname
修改ip
vi /etc/sysconfig/network-scripts/ifcfg-ens33
IPADDR=192.168.39.101
重启
reboot

vmware终端修改2个虚拟机的
vi /etc/hosts
192.168.39.101 a1
192.168.39.102 a2

ping对方虚拟机ip
使用浏览器访问ip
192.168.39.101:8080

[root@a1 opt]# su es
[es@a1 opt]$ cd es/
[es@a1 es]$ cd elasticsearch-6.3.1/
[es@a1 elasticsearch-6.3.1]$ cd config/
[es@a1 config]$ ls
elasticsearch.keystore jvm.options role_mapping.yml users
elasticsearch.yml log4j2.properties roles.yml users_roles
[es@a1 config]$ vi elasticsearch.yml
[root@a1 ~]# mkdir -p /path/to/data
[root@a1 ~]# mkdir -p /path/to/logs
[root@a1 ~]# mkdir -p /path/to/data/nodes

注意授权!
[root@a1 bin]# chmod 777 -R /path
[root@a2 ~]# cd /opt/es/elasticsearch-6.3.1/bin/
[es@a2 bin]# ./elasticsearch
[es@a2 bin]$ nohup ./elasticsearch &
启动成功,查看master和slave
[es@a2 bin]$ ps -ef|grep 9200
es 5416 4375 0 14:09 pts/1 00:00:00 grep --color=auto 9200
[es@a2 bin]$ kill -9 4375
已杀死
注意切换用户启动

注意在75行2那里的空格!
-------------配置文件直接复制改3出ip端口号 mkdir -p /path/to/data - mkdir -p /path/to/logs

======================== Elasticsearch Configuration =========================

NOTE: Elasticsearch comes with reasonable defaults for most settings.

Before you set out to tweak and tune the configuration, make sure you

understand what are you trying to accomplish and the consequences.

The primary way of configuring a node is via this file. This template lists

the most important settings you may want to configure for a production cluster.

Please consult the documentation for further information on configuration options:

https://www.elastic.co/guide/en/elasticsearch/reference/index.html

---------------------------------- Cluster -----------------------------------

Use a descriptive name for your cluster:

cluster.name: my-application

------------------------------------ Node ------------------------------------

Use a descriptive name for the node:

node.name: node-2

Add custom attributes to the node:

#node.attr.rack: r1

----------------------------------- Paths ------------------------------------

Path to directory where to store the data (separate multiple locations by comma):

node.master: true
node.data: true
path.data: /path/to/data

Path to log files:

path.logs: /path/to/logs

----------------------------------- Memory -----------------------------------

Lock the memory on startup:

#bootstrap.memory_lock: true

Make sure that the heap size is set to about half the memory available

on the system and that the owner of the process is allowed to use this

limit.

Elasticsearch performs poorly when the system is swapping the memory.

---------------------------------- Network -----------------------------------

Set the bind address to a specific IP (IPv4 or IPv6):

network.host: 192.168.39.102

Set a custom port for HTTP:

http.port: 9200
transport.tcp.port: 9300

For more information, consult the network module documentation.

--------------------------------- Discovery ----------------------------------

Pass an initial list of hosts to perform discovery when new node is started:

The default list of hosts is [“127.0.0.1”, “[::1]”]

discovery.zen.ping.unicast.hosts: [“192.168.39.101”,“192.168.39.102”]

Prevent the “split brain” by configuring the majority of nodes (total number of master-eligible nodes / 2 + 1):

discovery.zen.minimum_master_nodes: 2

For more information, consult the zen discovery module documentation.

---------------------------------- Gateway -----------------------------------

Block initial recovery after a full cluster restart until N nodes are started:

#gateway.recover_after_nodes: 3

For more information, consult the gateway module documentation.

---------------------------------- Various -----------------------------------

Require explicit names when deleting indices:

#action.destructive_requires_name: true

集群测试 配置kibana
[root@a1 ~]# vi /opt/es/kibana-6.3.1-linux-x86_64/config/kibana.yml
elasticsearch.url: “http://192.168.39.101:9200”
elasticsearch.url: “http://192.168.39.102:9200”

[root@a2 ~]# cd /opt/es/kibana-6.3.1-linux-x86_64/bin/
[root@a2 bin]# ./kibana
开启kibana

浏览器访问

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值