Does IP Sharing require me to set up keepalived myself?

I'm investigating high-availability setups and found Linode's IP Sharing:

https://www.linode.com/docs/platform/manager/remote-access/#configuring-ip-sharing

As I understand it, I can:

  1. Set up a replica of my main server
  2. Use IP Sharing to share the main server's IP with the replica

In the case of failure on the main server, the replica will take over the IP.

My question is: do I need to set up keepalived myself on the two servers, or does Linode do it for me under-the-hood when I enable IP Sharing?

14 Replies

You'd have to set up some mechanism yourself to bring up the failover IP address (which should be a second IP address, open a ticket to get one) on the secondary system, whether that is keepalived or something else. Linode has no way of doing this for you, as they have no access to the internals of your Linode.

Bit confused what you mean by failover address being a second IP.

My goal is to have a server always available at my main IP. If the main server goes down, I don’t understand how the failover/second IP comes into play here to achieve this result.

Do you mean that the replica server has its own IP (by default) and that I need to configure its failover/secondary IP to be the IP of the main?

Can you do IPv6 sharing?
The UI does not seem to allow it.

Same question here. What is the point of IP sharing if I need a second IP?

I don't think I understand how this works.

I am on a very low budget here. So this is my plan.

I will have exactly 2 VPS in the same datacenter. Both will be exact copies with glusterfs and galera configured to replicate db and application and config files across both servers.

I won't be using a nodebalancer - I am not looking for a load balancer. Though I use 2 servers, I expect only one to be actually used "active".

The second server, though exact copy, will act as a passive node - not doing anything at all except holding the replicated files and DBs.

What I want to do is:

  1. Both Server A & B will be up and running
  2. All requests will be routed only to Server A's IP. Hence everything will be serviced by Server A alone
  3. When server A crashes or is not responding, I need Server B to take over and start serving. This is where I hope I can share the IP from A to B so that the requests are served by B.
  4. This would continue until server B crashes (by that time I would bring up server A) and then server A would take over the IP.

Will this work? I don't intend to use Nodebalancer. I just need to be sure Server B starts serving.

You won't need a second IP on a single server to use IP Sharing. When you configure IP Sharing in the Cloud Manager, our networking will permit the IP address of your first server to be used on your second server when the first server fails. You would need to set up a service such as Keepalived in order for this to work properly. IP Sharing gives "permission" for the floating IP address to be used across two Linodes; Keepalived and its configurations take care of the specific instructions for what to do when the first server fails.

@mathewparet - You have the right idea here. In addition to the linked guide for Keepalived, I'd recommend taking a look at our high availability overview which explains how each piece works together to achieve a website that can handle failovers and other outages.

@jyoo - thank you for pointing out that I am on the right track. I have one more question.

Considering only 1 server will be active at a time, I really do not need to use galeria, I can use glusterfs for both database and files (since only one server will add new data). Is my understanding correct?

@mathewparet - You would need Galera for database replication, so that when you add data to your first server it is automatically replicated on your second server as well. GlusterFS takes care of scaling the size of your database, but Galera is what replicates the data.

Thank you @jyoo - just to confirm is a second IP required for this sharing?

No problem @mathewparet :) Nope, you just need two Linodes, each with a public IPv4. You don't need a second IP address on either of them to use IP Sharing.

Thank you @jyoo

I have been able to successfully configure gluster and galera. Now it is time for keepalived.

This is the configuration I came up with. Could you please validate to confirm this is correct?

MASTER:

! Configuration File for keepalived
global_defs {
    notification_email {
    }

    router_id LVS_DBCLUSTER
}

vrrp_script chk_nginx {
    script "pidof nginx"
    interval 2
}

vrrp_instance VI_1 {
    state MASTER
    interface eth0
    virtual_router_id 51
    priority 101

    track_interface {
        eth0
    }

    track_script {
        chk_nginx
    }

    authentication {
        auth_type PASS
        auth_pass example_password
    }

    unicast_src_ip  <secondary-server-public-ip, sharing enabled>
    unicast_peer {
    <secondary-server-public-ip>
    }

    virtual_ipaddress {
    <i am not sure what IP comes here>
    }
    notify_master "/bin/echo 'now master' > /tmp/keepalived.state"
    notify_backup "/bin/echo 'now backup' > /tmp/keepalived.state"
    notify_fault "/bin/echo 'now fault' > /tmp/keepalived.state"
}

SLAVE:

! Configuration File for keepalived
global_defs {
    notification_email {
    }

    router_id LVS_DBCLUSTER
}

vrrp_script chk_nginx {
    script "pidof nginx"
    interval 2
}

vrrp_instance VI_1 {
    state MASTER
    interface eth0
    virtual_router_id 51
    priority 101

    track_interface {
        eth0
    }

    track_script {
        chk_nginx
    }

    authentication {
        auth_type PASS
        auth_pass example_password
    }

    unicast_src_ip  <secondary-server-public-ip, sharing NOT enabled>
    unicast_peer {
    <master-server-public-ip>
    }

    virtual_ipaddress {
    <i am not sure what IP comes here>
    }
    notify_master "/bin/echo 'now master' > /tmp/keepalived.state"
    notify_backup "/bin/echo 'now backup' > /tmp/keepalived.state"
    notify_fault "/bin/echo 'now fault' > /tmp/keepalived.state"
}

Hello @mathewparet,

I am not a keepalived expert but I do enjoy tinkering with technology and would like to help you out the best I can! In reviewing our documentation and the config file you sent us, it seems you are missing a few spots to enter in some settings. Namely:

unicast_src_ip <secondary-server-public-ip, sharing enabled>

unicast_peer {
<secondary-server-public-ip>
}

virtual_ipaddress {
<i am not sure what IP comes here>
}

In addition, I believe you will need to add a path to some script in the line:
script "pidof nginx

Lastly, I would set up some sort of incremental testing of your set up. This helps me when I work on any problems or doing programming. Get one small part working, each at a time, and build from on top of each small victory. I would start with a working default configuration and adjust my configurations, one at a time, until I got to my goal. I, personally, can get frustrated when I try everything at once and it does not work. I then have to go back to the beginning and start over.

As we are the computing utility provider, your best resource regarding keepalived would be the documentation directly from the maintainers of keepalived. I believe this link for the configuration synopsis would be a great starting point in getting this up and running.

I hope this was helpful. Feel free to reach out again should you have any more questions!

All the best to you!

--
Nygel B.

@bennettnw2

Well they weren't a miss. I just didn't want to show the IP address in the below section. I just want someone to confirm it is correct - i.e, it is the public IP I have to configure in the below block. I am trying to avoid Nodebalancer (hence using public IP). But I am worried that if something goes wrong, the server might become inaccessible and I'll have to restore the backup. So I just want someone with experience to advise.

unicast_src_ip <secondary-server-public-ip, sharing enabled>

unicast_peer {
<secondary-server-public-ip>
}

And for the below block, I need advice which IP to put here:

virtual_ipaddress {
<i am not sure what IP comes here>
}

Thanks for the link to the Keepalived Config Synopsis. I am going through it :)

Hi

@mathewparet I'm also trying to achive this thing but no success, as I can see this is months old do you have anything working in that regards?

@mzubaisaleem If you are still looking for a solution, please let me know.

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct