gpt4 book ai didi

amazon-ec2 - Riak 节点在更改 IP 地址后不再工作

转载 作者:行者123 更新时间:2023-12-04 02:26:38 24 4
gpt4 key购买 nike

我使用实例化的 Amazon EC2 虚拟 Ubuntu 12.04 服务器作为我的单个 Riak 节点。我已经使用 basho 网站 上的指南完成了在实例上设置 Riak 的所有适当阶段。 here .在哪里 x.x.x.x 是实例的私有(private) IP 地址,包括:

安装

  • Using sudo su - to gain root privileges (EC2 logs me in as 'Ubuntu').

  • Installing the SSL Lib with:

    sudo apt-get install libssl0.9.8

  • Downloading the 64-bit package for 12.04:

    wget http://downloads.basho.com.s3-website-us-east-1.amazonaws.com/riak/CURRENT/ubuntu/precise/riak_1.2.1-1_amd64.deb

  • Then unpacking via:

    sudo dpkg -i riak_1.2.1-1_amd64.deb



根据 中的说明basho guide ,我更新了这两个文件(使用vi):

vm.args

  • Changing -name riak@x.x.x.x to the private IP of my instance.


应用程序配置

  • Changing {http, [ {"x.x.x.x", 8098 } ]} to the private IP of my instance.

  • Changing {pb_ip, "x.x.x.x"} to the private IP of my instance.



当我第一次设置服务器并执行上述操作时,Riak 节点工作正常,我可以连接到节点,并使用 riak start 然后 riak-admin test 成功返回:
>Attempting to restart script through sudo -H -u riak
>Successfully completed 1 read/write cycle to 'riak@x.x.x.x'

第二天我启动了实例,使用实例的新 IP 地址 重复上述过程(忽略安装) y.y.y.y (实例的私有(private) IP 在每次停止/启动时都会更改)并输入 riak start 进入终端,只会受到以下问候:
>Attempting to restart script through sudo -H -u riak
>Riak failed to start within 15 seconds,
>see the output of 'riak console' for more information.
>If you want to wait longer, set the environment variable
>WAIT_FOR_ERLANG to the number of seconds to wait

在 riak 控制台中给出的错误是:
>gen_server riak_core_capability terminated with reason: no function clause matching orddict:fetch('riak@y.y.y.y', [{'riak@x.x.x.x',[{{riak_core,staged_joins},[true,false]},{{riak_core,vnode_routing},[proxy,...]},...]}])

在哪里 y.y.y.y 是新的实例 IP 地址和 x.x.x.x 是旧的。

我已经为此苦恼了一段时间,找不到任何关于该主题的内容,我能想到的唯一解决方案是重新安装 Riak,以防我的 PATH 目录出错。如果失败了,我最后的办法是终止实例并在新实例上重新配置 Riak。所以在我开枪之前,我想问的是:
  • 更新 app.config 中的字段后和 vm.args使用新的实例 IP 地址,为什么 riak start 命令不再成功?
  • 有没有办法为 Ubuntu EC2 实例分配静态私有(private) IP?这不仅有助于解决问题,而且节省了我更新 app.config 的时间。和 vm.args每次我启动/停止实例。
  • 最佳答案

    因此,经过更多的挖掘和深入的阅读,我找到了一个解决方案:

    You need to remove the Riak ring and start Riak again to reset riak_core.



    您可以通过在终端中使用以下命令来执行此操作:

    rm -rf /var/lib/riak/ring/*

    • NOTE: This should be done after you've updated app.config and vm.args with the new server IP, nasty side-effects can occur otherwise.


    然后

    riak start



    在发出 之后,我不再被抛出“连接失败”错误。 riak-admin test 我愉快地收到了命令(其中 y.y.y.y 是我的实例的私有(private) IP):
    >Attempting to restart script through sudo -H -u riak
    >Successfully completed 1 read/write cycle to 'riak@y.y.y.y'

    I should note that this solution applies to virtual servers as well as physical ones. Although I would imagine the reassigning of IP's would be a much rarer occurrence in physical servers.



    现在虽然这解决了问题,但它仍然意味着每当我需要重新启动实例时,我都必须编辑 app.configvm.args文件来更改私有(private) IP 地址(记住每次启动/停止 Ubuntu 实例时私有(private) IP 都会更改),然后使用上面的命令清除 Riak 环,因此这不是一个优雅的解决方案。

    如果有人知道为 EC2 实例设置静态私有(private) IP 的方法(或解决这两个障碍的另一种解决方案?),它将彻底解决这个问题。

    编辑:12 年 12 月 14 日

    将静态 IP 分配给 EC2 实例的有限解决方案:

    Amazon Web Services allows the association of Elastic IP's to EC2 instances (of any kind). Therefore, if an instance has an elastic IP associated with it, even if it is rebooted, that IP will remain associated with that instance. You can find the documentation on elastic IP's here.

    If you're under Amazon's free usage tier, creating an Elastic IP shouldn't charge you as long as it's associated with a running instance. If an elastic IP is disassociated, Amazon will incur charges for each running hour of an unused Elastic IP for as long as that Elastic IP remains disassociated. For example, terminating an instance will disassociate an elastic IP, unless that elastic IP is re-associated or released, the above applies. Stopping your instance entirely then starting it at a later time will also disassociate an elastic IP.

    You can have a maximum of one elastic IP per an instance, any more and this will incur charges.

    For those interested, you can find more information Elastic IP's pricing here under Elastic IP Addresses.

    关于amazon-ec2 - Riak 节点在更改 IP 地址后不再工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13859906/

    24 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com