linux下Elasticsearch 集群安装

背景

由于漏洞现有版本需要升级到5.6.12,试着自己搭建并且将现有5.2.2版本的数据迁移到5.6.12

下载地址:https://www.elastic.co/cn/downloads/past-releases/elasticsearch-5-6-12

ik分词器下载地址:https://github.com/medcl/elasticsearch-analysis-ik/releases/tag/v5.6.16

cerebrox下载地址:https://github.com/lmenezes/cerebro/tags

安装

注意这里用非root安装,并且依赖jdk1.8(自己安装)

准备3台虚拟机:

ip1:192.168.0.4

ip2:192.168.0.5

ip3:192.168.0.6

tar -zxvf elasticsearch-5.6.16.tar.gz

进入elasticsearch-5.6.16文件夹的config目录,打开elasticsearch.yml编辑

cluster.name: es5.6

node.name: es5.6-d1
#开启Master节点
node.master: true
#开启数据节点
node.data: true

bootstrap.seccomp: false
bootstrap.memory_lock: false

network.host: 192.168.0.4
http.port: 9003
transport.tcp.port: 9103

discovery.zen.ping.unicast.hosts: ["192.168.0.4:9103","192.168.0.5:9103","192.168.0.6:9103"]
discovery.zen.minimum_master_nodes: 2
#数据路径
path.data: /home/elastic/elasticsearch-5.6.16/data
path.logs: /home/elastic/elasticsearch-5.6.16/logs

编辑config/jvm.options

-Xms4g
-Xmx4g

进入elasticsearch-5.6.16/plugins 新建文件夹ik,把下载的ik分词器的文件考入

其他2台同上配置,需要把network.host改成相对应的Ip,node.name也改成es5.6-d2, es5.6-d3

启动

启动命令

sh ./elasticsearch-5.6.16/bin/elasticsearch -d

cerebrox安装

直接解压,进入当前cerebrox/conf,

编辑application.conf文件

hosts = [
  #{
  #  host = "http://localhost:9200"
  #  name = "Localhost cluster"
  #  headers-whitelist = [ "x-proxy-user", "x-proxy-roles", "X-Forwarded-For" ]
  #}
  # Example of host with authentication
  {
    host = "http://192.168.0.4:9003"
    name = "es5.6"
    auth = {
      username = "test"
      password = "test"
    }
  },
  {
    host = "http://192.168.0.5:9003"
    name = "es5.6"
    auth = {
      username = "test"
      password = "test"
    }
  },
  {
    host = "http://192.168.0.6:9003"
    name = "es5.6"
    auth = {
      username = "test"
      password = "test"
    }
  }
]

运行:windows运行:bin/cerebro.bat , linux运行:bin/cerebro,

访问:http://localhost:9000/

效果图:


资料39.jpg

数据迁移

将原来5.2.2的数据直接拷贝到5.6.12的data里面,然后启动5.6.12

你可能感兴趣的:(linux下Elasticsearch 集群安装)