Резервирование с помощью CARP

CARP – протокол, позволяющий задействовать один IP-адрес для нескольких машин в сети. Таким образом можно реализовать отказоустойчивость (избыточность) и масштабирование (увеличение нагрузки). Пусть у нас имеется два сервера с собственными ip-адресами – 10.0.0.2 и 10.0.0.3, и хочется дополнительно настроить общий адрес 10.0.0.1, который предоставляет какой-либо сервис пользователям (к примеру, маршрутизация или DNS). Инструкция по использованию технологии CARP под катом.

Ядро
Первым делом собираем свое ядро. Скачиваем исходники

sysinstall

Выбираем Configure – Distributions – src, отмечаем галочкой base и src.
Настраиваем конфиг ядра, кладем его в /root/kernels и компилируем. Проделываем эти действия на обоих серверах.

# cd /usr/src/sys/i386/conf
# mkdir -p /root/kernels
# cp GENERIC /root/kernels/CARP
# ln -s /root/kernels/CARP
# vim CARP
device carp
# cd /usr/src
# make buildkernel KERNCONF=CARP
# make installkernel KERNCONF=CARP
# vim /etc/sysctl.conf
net.inet.carp.preempt=1

Настраиваем carp-интерфейс на основном сервере:

# vim /etc/rc.conf
cloned_interfaces="carp0"
ifconfig_carp0="vhid 1 pass secretpassword advskew 0 10.0.0.1/24"

На запасном сервере:

# vim /etc/rc.conf
cloned_interfaces="carp0"
ifconfig_carp0="vhid 1 pass secretpassword advskew 100 10.0.0.1/24"

Объединяемые интерфейсы должны обладать одинаковыми параметрами vhid и pass. Параметр advskew отвечает за приоритет. Чем меньше – тем “главнее” будет интерфейс. Когда интерфейс с наименьшим advskew упадет, главным (т.е. MASTER) станет интерфейс со вторым по значению параметром advskew.

Перезагружаемся. Пробуем вытащить кабель из основного сервера. Радуемся, если все продолжает работать.

Также с помощью CARP можно создавать высокопроизводительные кластеры. Об этом, а также о том, как запускать сервисы по подъему CARP, в следующий раз.

Похожие статьи

146 thoughts on “Резервирование с помощью CARP”

  1. I don’t even know the way I finished up right here, but I assumed this put up was once
    great. I don’t understand who you might be however definitely you’re going to a famous
    blogger if you happen to aren’t already. Cheers!

  2. I delight in, result in I discovered just what I used to be having a look for.
    You’ve ended my 4 day long hunt! God Bless you
    man. Have a nice day. Bye

  3. Do you have a spam issue on this site; I also am a blogger,
    and I was wanting to know your situation; many of us have created some nice practices
    and we are looking to trade methods with other folks, please
    shoot me an e-mail if interested.

  4. What’s up everyone, it’s my first pay a visit at this website, and article is actually fruitful for me,
    keep up posting these types of content.

  5. naturally like your web site however you have to take a
    look at the spelling on several of your posts. A number of them are
    rife with spelling problems and I in finding it very troublesome to tell the reality however I will certainly come again again.

  6. Pretty section of content. I just stumbled upon your website and in accession capital to assert that I get actually enjoyed account your blog posts.
    Anyway I’ll be subscribing to your augment and even I achievement you access consistently rapidly.

  7. Hi there, I desire to subscribe for this website to get most recent updates, so where can i do it please help out.

  8. exciting review. Way too visit typically the site that
    will be competed situs slot online. This kind of awesome web page has received detection with judi slot game playing challengers in Negara
    sendiri. Truth be told there are many fascinating
    promos predicament join now.

  9. First of all I would like to say terrific blog! I had a quick question in which I’d like
    to ask if you don’t mind. I was curious to know how you
    center yourself and clear your head prior to writing.
    I have had a hard time clearing my mind in getting my ideas out there.
    I truly do take pleasure in writing but it just seems like the first 10 to 15 minutes
    are wasted simply just trying to figure out how to begin. Any suggestions or tips?
    Kudos!

  10. I read this paragraph fully regarding the resemblance of most up-to-date and preceding technologies, it’s remarkable article.

  11. You can certainly see your skills within the article you write.
    The world hopes for even more passionate writers such as you who aren’t afraid to say
    how they believe. At all times follow your heart.

  12. What i do not realize is in reality how you are no longer really a lot more well-liked than you might be
    right now. You are very intelligent. You already know
    therefore significantly on the subject of this matter, made me individually imagine it from a lot of numerous angles.
    Its like women and men don’t seem to be fascinated unless
    it’s one thing to accomplish with Lady gaga! Your personal stuffs outstanding.
    Always handle it up!

  13. exciting review. Moreover visit my very own site to realize game
    slot online. This great website has received acknowledgement coming
    from slot deposit pulsa tanpa potongan video games game enthusiasts in Dalam negri.

    Truth be told there are usually a lot of wanted
    promos in case you join right now.

  14. It’s remarkable designed for me to have a web page, which is good designed for
    my knowledge. thanks admin

  15. What’s up to every body, it’s my first go to see of this
    weblog; this website contains remarkable and genuinely excellent
    material in support of visitors.

  16. Hello there! Quick question that’s entirely off
    topic. Do you know how to make your site mobile friendly?
    My blog looks weird when browsing from my iphone. I’m trying to find a
    theme or plugin that might be able to fix this problem.

    If you have any recommendations, please share. With thanks!

  17. whoah this blog is fantastic i love reading your articles.
    Keep up the great work! You realize, lots of people are looking round
    for this info, you could aid them greatly.

Leave a Reply

Your email address will not be published. Required fields are marked *