通过扩容方式进行集群迁移
    1.已PST54集群为例
    当前pst54集群机器数为5台,
    ip:
    10.150.92.1(master)
    10.150.92.2(master)
    10.150.92.3(master)
    10.150.92.4
    10.150.92.5
    迁移后pst54集群机器数为5台,
    ip:
    10.152.10.11(master)
    10.152.10.12(master)
    10.152.10.13(master)
    10.152.10.14
    10.152.10.15

    2.迁移前请先确认是否存在磁盘大小差异过大,导致磁盘打满的可能

    3.运维监控平台
    点击资源运营-Agent管理,为需要加入集群的机器下发最新的agent版本
    点击集群管理-集群bdp-pst54-ssd-主机列表-添加主机,将需要扩容进集群的机器先加入主机列表
    点击服务实例-扩容,将10.152.10.11,10.152.10.12,10.152.10.13,10.152.10.14,10.152.10.15五台机器扩入集群,
    扩容前请先关闭集群重平衡,以防数据迁入新集群

    4.扩容完成后,当前集群内有10台机器,将新扩进去的5台机器停服务
    之后的操作是修改10.152.10.11,10.152.10.12,10.152.10.13,10.152.10.14,10.152.10.15五台机器的配置文件
    将10.152.10.11,10.152.10.12两台es-1的配置文件中
    http.enabled: false 替换为 http.enabled: true
    discovery.zen.ping.unicast.hosts: [“10.150.92.1:9300”,”10.150.92.2:9300”,”10.150.92.3:9300”] 替换为
    discovery.zen.ping.unicast.hosts: [“10.150.92.1:9300”,”10.150.92.2:9300”,”10.150.92.3:9300”,”10.152.10.11:9300”,”10.152.10.12:9300”]
    10.152.10.13的es-1配置文件
    http.enabled: false 替换为 http.enabled: true
    discovery.zen.ping.unicast.hosts: [“10.150.92.1:9300”,”10.150.92.2:9300”,”10.150.92.3:9300”] 替换为
    discovery.zen.ping.unicast.hosts: [“10.152.10.11:9300”,”10.152.10.12:9300”,”10.152.10.13:9300”]
    其他节点
    discovery.zen.ping.unicast.hosts: [“10.150.92.1:9300”,”10.150.92.2:9300”,”10.150.92.3:9300”] 替换为
    discovery.zen.ping.unicast.hosts: [“10.152.10.11:9300”,”10.152.10.12:9300”,”10.152.10.13:9300”]

    具体命令
    登陆salt机器
    salt -S ‘10.152.10.11’ cmd.run “sed -i ‘s/discovery.zen.ping.unicast.hosts: [\”10.150.92.1:9300\”,\”10.150.92.2:9300\”,\”10.150.92.3:9300\”]/discovery.zen.ping.unicast.hosts: [\”10.152.10.11:9300\”,\”10.152.10.12:9300\”,\”10.152.10.13:9300\”,\”10.150.92.1:9300\”,\”10.150.92.2:9300\”]/g’ /app/es-1/config/elasticsearch.yml”

    salt -S ‘10.152.10.11’ cmd.run “sed -i ‘s/discovery.zen.ping.unicast.hosts: [\”10.150.92.1:9300\”,\”10.150.92.2:9300\”,\”10.150.92.3:9300\”]/discovery.zen.ping.unicast.hosts: [\”10.152.10.11:9300\”,\”10.152.10.12:9300\”,\”10.152.10.13:9300\”]/g’ /app/es-2/config/elasticsearch.yml”

    salt -S ‘10.152.10.11’ cmd.run “sed -i ‘s/discovery.zen.ping.unicast.hosts: [\”10.150.92.1:9300\”,\”10.150.92.2:9300\”,\”10.150.92.3:9300\”]/discovery.zen.ping.unicast.hosts: [\”10.152.10.11:9300\”,\”10.152.10.12:9300\”,\”10.152.10.13:9300\”]/g’ /app/es-3/config/elasticsearch.yml”

    salt -S ‘10.152.10.11’ cmd.run “sed -i ‘s/discovery.zen.ping.unicast.hosts: [\”10.150.92.1:9300\”,\”10.150.92.2:9300\”,\”10.150.92.3:9300\”]/discovery.zen.ping.unicast.hosts: [\”10.152.10.11:9300\”,\”10.152.10.12:9300\”,\”10.152.10.13:9300\”]/g’ /app/es-4/config/elasticsearch.yml”

    salt -S ‘10.152.10.12’ cmd.run “sed -i ‘s/discovery.zen.ping.unicast.hosts: [\”10.150.92.1:9300\”,\”10.150.92.2:9300\”,\”10.150.92.3:9300\”]/discovery.zen.ping.unicast.hosts: [\”10.152.10.11:9300\”,\”10.152.10.12:9300\”,\”10.152.10.13:9300\”,\”10.150.92.1:9300\”,\”10.150.92.2:9300\”]/g’ /app/es-1/config/elasticsearch.yml”

    salt -S ‘10.152.10.12’ cmd.run “sed -i ‘s/discovery.zen.ping.unicast.hosts: [\”10.150.92.1:9300\”,\”10.150.92.2:9300\”,\”10.150.92.3:9300\”]/discovery.zen.ping.unicast.hosts: [\”10.152.10.11:9300\”,\”10.152.10.12:9300\”,\”10.152.10.13:9300\”]/g’ /app/es-2/config/elasticsearch.yml”

    salt -S ‘10.152.10.12’ cmd.run “sed -i ‘s/discovery.zen.ping.unicast.hosts: [\”10.150.92.1:9300\”,\”10.150.92.2:9300\”,\”10.150.92.3:9300\”]/discovery.zen.ping.unicast.hosts: [\”10.152.10.11:9300\”,\”10.152.10.12:9300\”,\”10.152.10.13:9300\”]/g’ /app/es-3/config/elasticsearch.yml”

    salt -S ‘10.152.10.12’ cmd.run “sed -i ‘s/discovery.zen.ping.unicast.hosts: [\”10.150.92.1:9300\”,\”10.150.92.2:9300\”,\”10.150.92.3:9300\”]/discovery.zen.ping.unicast.hosts: [\”10.152.10.11:9300\”,\”10.152.10.12:9300\”,\”10.152.10.13:9300\”]/g’ /app/es-4/config/elasticsearch.yml”

    salt -S ‘10.152.10.13’ cmd.run “sed -i ‘s/discovery.zen.ping.unicast.hosts: [\”10.150.92.1:9300\”,\”10.150.92.2:9300\”,\”10.150.92.3:9300\”]/discovery.zen.ping.unicast.hosts: [\”10.152.10.11:9300\”,\”10.152.10.12:9300\”,\”10.152.10.13:9300\”]/g’ /app/es-*/config/elasticsearch.yml”

    salt -S ‘10.152.10.14’ cmd.run “sed -i ‘s/discovery.zen.ping.unicast.hosts: [\”10.150.92.1:9300\”,\”10.150.92.2:9300\”,\”10.150.92.3:9300\”]/discovery.zen.ping.unicast.hosts: [\”10.152.10.11:9300\”,\”10.152.10.12:9300\”,\”10.152.10.13:9300\”]/g’ /app/es-*/config/elasticsearch.yml”

    salt -S ‘10.152.10.15’ cmd.run “sed -i ‘s/discovery.zen.ping.unicast.hosts: [\”10.150.92.1:9300\”,\”10.150.92.2:9300\”,\”10.150.92.3:9300\”]/discovery.zen.ping.unicast.hosts: [\”10.152.10.11:9300\”,\”10.152.10.12:9300\”,\”10.152.10.13:9300\”]/g’ /app/es-*/config/elasticsearch.yml”

    http.enabled: false 替换为 http.enabled: true建议手动改

    修改之后,启服务,10.152.10.13不启服务(为了防止集群master节点偶数个产生集群脑裂,且pst54集群上数据少,迁移过程中确保了少一台机器的情况下磁盘空间可以满足需求,所以10.152.10.13不启服务)
    su - elastic -c ‘/app/es-1/bin/elasticsearch -d’
    su - elastic -c ‘/app/es-2/bin/elasticsearch -d’
    su - elastic -c ‘/app/es-3/bin/elasticsearch -d’
    su - elastic -c ‘/app/es-4/bin/elasticsearch -d’

    4.登陆机器10.152.10.11,使用curl -s 10.152.10.11:9200/_cat/nodes
    观察目前新的master节点是否可以使用9200查看集群信息,并且观察目前集群内的master节点是那些
    确保通过新的master节点可以访问集群

    5.确认无误后,打开重平衡,踢掉旧节点进行数据迁移
    curl -X PUT 10.150.92.1:9200/_cluster/settings -d ‘{“transient”:{“cluster.routing.allocation.exclude._ip”:”10.150.92.4,10.150.92.5” } }’
    curl -X PUT 10.150.92.1:9200/_cluster/settings -d ‘{“transient”:{“cluster.routing.allocation.exclude._name”:”10.150.92.1:9301,10.150.92.1:9302,10.150.92.1:9303,10.150.92.2:9301,10.150.92.2:9302,10.150.92.2:9303,10.150.92.3:9301,10.150.92.3:9302,10.150.92.3:9303” } }’

    6.数据全部迁移完毕后,可停原data节点服务

    此时集群内服务正常的有7台机器,5台master(旧3+新2) 2台data(新) 数据已全迁至新集群

    通知用户切任务(需用户汇总,实时任务、调度任务、搜索平台接口等都需要修改数据库,找伟哥、林佳)

    确保集群中没有其他外部ip在连接了,如果有的话,需要找到这个ip是谁的

    用户切完任务后,可先让用户确认,任务是否能正常运行,正常运行的情况下,可进行下线原master操作
    1)10.150.92.1停服务,观察集群健康度
    2)10.152.10.13启服务,观察集群健康度
    3)10.150.92.2停服务,观察集群健康度
    4)10.152.10.12修改es-1配置,重启服务,观察集群健康度
    5)10.150.92.3停服务,观察集群健康度
    6)10.152.10.11修改es-1配置,重启服务,观察集群健康度

    切换完成,集群确认正常,且用户也确认无误,发邮件通知用户下线机器