safekit 을 이용한 이중화 구현 방법 입니다.


Configure High Availability(FARM) BY SAFEKIT
Enviroments
  1. OS:
   Version : Cent OS 7.3
        # Private (heartbeat)
           Svr1 : 192.168.56.120 (node1)
           Svr2 : 192.168.56.121 (node2)
           Vip : 192.168.56.125
  1. 2 node configuration Active-Active server farm ( apache web service)

Configure the active-active 2node as shown below.


Step #1 : download file and unzip
[root@svr1 ~]# ./safekitlinux_x86_64_7_3_0_12.bin
UnZipSFX 5.50 of 17 February 2002, by Info-ZIP (Zip-Bugs@lists.wku.edu).
  inflating: safekitinstall          
  inflating: safekitlicense.txt      
  inflating: safekit_x86_64_7_3_0_12.rpm  

Step# 2 : rpm package install
[root@svr1 ~]# rpm -Uvh safekit_x86_64_7_3_0_12.rpm
Preparing...                          ################################# [100%]
Updating / installing...
   1:SafeKit-7.3.0-12                 ################################# [100%]
Targeting files
Adding password for user Console
post: Clean Install
Creating safekit User
Configuring Systemd
Starting Administration Daemon using systemd
Checking web configuration files revision
Checking snmp configuration files revision
Starting Web Server

Step# 3 : kernel compile
VIP  configuration is required kernel  compile
[root@svr1 ~]# cd /opt/safekit/kernel/
[root@svr1 kernel]# ls
checksum.c  crc32.tab     drop_cache.h      fragment_cache.h  lb_methods.c  lbrule.h  Makefile         service.c  syscalls.c    viplib.c     viptranslate.c
checksum.h  drop_cache.c  fragment_cache.c  include           lbrule.c      linux     Makefile.debian  service.h  vip_device.c  vip_mutex.h
[root@svr1 kernel]# make
Compiling vip module
The source code for certain components of the software is provided in this version. This source code is provided solely to enable end-user to compile such component in order to create the corresponding object code as necessary to operate on End-User's Authorised Platform.  All rights including all intellectual property rights in and to  this source code and to the resulting object code are and remain proprietary to Evidian. End-User may not modify, adapt, translate, reproduce, distribute, sub-license, divulge or in any way  use the source code for any other purpose than the purpose specified above
make -C /lib/modules/3.10.0-693.el7.x86_64/build SUBDIRS=/opt/safekit/kernel modules
make[1]: Entering directory `/usr/src/kernels/3.10.0-693.el7.x86_64'
  CC [M]  /opt/safekit/kernel/checksum.o
  CC [M]  /opt/safekit/kernel/drop_cache.o
  CC [M]  /opt/safekit/kernel/fragment_cache.o
  CC [M]  /opt/safekit/kernel/lb_methods.o
  CC [M]  /opt/safekit/kernel/lbrule.o
  CC [M]  /opt/safekit/kernel/service.o
/opt/safekit/kernel/service.c: In function 'vip_snapshot_services':
/opt/safekit/kernel/service.c:21:35: warning: statement with no effect [-Wunused-value]
#define UNREFERENCED_PARAMETER(a) (a)
                                   ^
/opt/safekit/kernel/service.c:402:2: note: in expansion of macro 'UNREFERENCED_PARAMETER'
  UNREFERENCED_PARAMETER(snap);
  ^
  CC [M]  /opt/safekit/kernel/syscalls.o
  CC [M]  /opt/safekit/kernel/vip_device.o
  CC [M]  /opt/safekit/kernel/viplib.o
  CC [M]  /opt/safekit/kernel/viptranslate.o
/opt/safekit/kernel/viptranslate.c: In function 'vip_apply_rules':
/opt/safekit/kernel/viptranslate.c:7:35: warning: statement with no effect [-Wunused-value]
#define UNREFERENCED_PARAMETER(a) (a)
                                   ^
/opt/safekit/kernel/viptranslate.c:490:3: note: in expansion of macro 'UNREFERENCED_PARAMETER'
   UNREFERENCED_PARAMETER(flow);
   ^
  CC [M]  /opt/safekit/kernel/linux/callbacks.o
/opt/safekit/kernel/linux/callbacks.c: In function 'open_device':
/opt/safekit/kernel/linux/callbacks.c:549:20: warning: assignment from incompatible pointer type [enabled by default]
   device->n_ops_p  = &dev->netdev_ops;
                    ^
  CC [M]  /opt/safekit/kernel/linux/filter.o
  CC [M]  /opt/safekit/kernel/linux/linux_syscalls.o
  CC [M]  /opt/safekit/kernel/linux/packet_filter.o
  LD [M]  /opt/safekit/kernel/vip.o
  Building modules, stage 2.
  MODPOST 1 modules
  CC      /opt/safekit/kernel/vip.mod.o
  LD [M]  /opt/safekit/kernel/vip.ko
make[1]: Leaving directory `/usr/src/kernels/3.10.0-693.el7.x86_64'
mkdir -p /lib/modules/3.10.0-693.el7.x86_64/extra;
cp /opt/safekit/kernel/vip.ko /lib/modules/3.10.0-693.el7.x86_64/extra;
rm -f /lib/modules/3.10.0-693.el7.x86_64/weak-updates/vip.ko;
/sbin/depmod -ae -F /lib/modules/3.10.0-693.el7.x86_64/build/System.map 3.10.0-693.el7.x86_64
[root@svr1 kernel]#
Step# 4 : licence register
  1. Get a temporary license for testing    Safekit one-month key select
Choose safekit one-month key
Here we have a 30-day license for testing.
If you enter your information, you can receive the license file by mail.

  1. Your information resgiter

  1. Receive your license key via email

 
  1. Paste license file (/opt/safekit/conf)
Put the file in that location as shown below.
[root@svr2 conf]# ls -al
-rw-r--r--  1 root    root    823 Nov 15 16:12 license.txt
[root@svr1 conf]# vi license.txt
# Before License Key installation, pay attention to any product-specific instructions.
# ONLY USE A TEXT EDITOR to edit the specified files. DO NOT USE word processors.
#
# SafeKit
# Please copy or append the License Keys to the safekit/conf/license.txt file.
# Hostname: any
# -------------------------The License Keys start below--------------------------
# multi-modules Version 7 license key for machine any OS any available up to 2017/12
1|Evidian/00007d1e|16862755|2017|12|1|any|any|7.0|multi-modules|test-drive|252af2bcd908ec46a8c1f370567a21fe
# mono-module Version 7 license key for machine any OS any available up to 2017/12
1|Evidian/0000383b|16862754|2017|12|1|any|any|7.0|mono-module|test-drive|688f310be603d0a8ce1707e657b93a17
# --------------------------The License Keys end above---------------------------
Step# 5 : configure server farm
  1. Node 1, 2 …. Resgister
Register the server to be configured in the server farm.

  1. Node check

  1. Network  configuration
If the configuration is a server farm,Virtual IP and Pysical IP is required (two)

  1. VIP configuration 
Register the vip and service port(80,9010).  Select ipcheck , interface check, reroute

  1. Apply the configuration

  1. Check result

  1. apache -cluseter1 start
Click the Start button to start the service.

  1. monitoring check

  1. control check

  1. advanced configuration click
Select the appropriate part to modify the settings.

11)  Userconfig.xml file update

Userconfig.xml file configuration
<!DOCTYPE safe>
<safe>
   <service mode="farm" loop_interval="24" maxloop="3">
      <farm>
         <lan name="default">
         </lan>
      </farm>
      <user>
         <var name="APACHE_CTL" value="/usr/sbin"/>
      </user>
      <vip>
         <interface_list>
            <interface check="on" arpelapse="10" arpinterval="60" arpreroute="on">
               <virtual_interface type="vmac_directed">
                  <virtual_addr addr="192.168.56.125" check="on" where="alias"/>
               </virtual_interface>
            </interface>
         </interface_list>
         <loadbalancing_list>
            <group name="FarmProto">
               <!-- Set load-balancing rule -->
               <rule filter="on_port" proto="tcp" port="80"/>
               <rule filter="on_port" proto="tcp" port="9010"/>
            </group>
         </loadbalancing_list>
      </vip>
      <check>
         <tcp ident="HTTP_APACHE" when="both">
            <to timeout="5" addr="192.168.56.125" port="80" interval="10"/>
         </tcp>
      </check>
   </service>
</safe>
12) stop_both file update

Stop_both scripts file
#!/bin/sh
# Script called on the primary and secondary servers for stopping applications
# started in start_both
#
# If needed, add new applications stopping functions and calls
# Execute recovery/cleanup procedures after stopping
# to allow quick restart 
# To locally apply a new stop_both, stop and start SafeKit
# To remotly apply the new stop_both, copy stop_both on the
# remote host and stop and start SafeKit
#----------------------------------------------------------
#       Logging functions
#----------------------------------------------------------
#
#   use $SAFE/safekit printi | printe | printw      "message"
#        printi: log I[nformative] message in SafeKit log
#        printe: log E[vent] message
#        printw: log W[arning] message
#----------------------------------------------------------
#            Applications stopping functions
#
# 2 stopping mode
# - graceful stop
#   call standard application stop
# - force stop ($1=force)
#   kill application's processes 
#
# Use the following command to send signal to processes
#            $SAFEBIN/killit +signal_name name_of_processes 1>/dev/null 2>&1
#            (+TERM for graceful stop, +KILL for force stop)
#----------------------------------------------------------
# function example
apache()
{
  retval=0
  # graceful stop
  $APACHE_CTL/apachectl stop
  if [ $? -ne 0 ] ; then
    $SAFE/safekit printi "Apache stop failed"
#    retval=1
  else
    $SAFE/safekit printi "Apache stopped"
  fi
  return $retval
}
#----------------------------------------------------------
#            Main program for stopping
#----------------------------------------------------------
res=0
#----------------------------------------------------------
#            Applications stopping calls              
#
# Bounded time to execute to ensure non blocking stop:
# - nicestoptimeout value for graceful stop
# - forcestoptimeout value for force stop ($1=force)
#
#----------------------------------------------------------
# default: no action on forcestop
[ "$1" = "force" ] && exit 0
# Fill with your application stop call
# and set res=0 if successfull
# or set res=1 if failed
# TODO
# change PREFIX value for Apache path layout if different from Classical
apache || res=$?
[ $res -ne 0 ] && $SAFE/safekit printi "stop_both failed"
exit 0
13) start_both file update

Start_both script file
#!/bin/sh
# Script called on the primary and secondary servers for starting applications
#
# If needed, add new applications starting functions and calls
# Execute recovery/cleanup procedures before starting
# to allow start after crash 
# To locally apply a new start_both, stop and start SafeKit
# To remotly apply the new start_both, copy start_both on the
# remote host and stop and start SafeKit
#----------------------------------------------------------
#       Logging functions
#----------------------------------------------------------
#
#   use $SAFE/safekit printi | printe | printw      "message"
#        printi: log I[nformative] message in SafeKit log
#        printe: log E[vent] message
#        printw: log W[arning] message
#----------------------------------------------------------
#            Applications starting functions
#----------------------------------------------------------
apache()
{
  retval=0
  $APACHE_CTL/apachectl start
  if [ $? -ne 0 ] ; then
    $SAFE/safekit printi "Apache start failed"
    retval=1
  else
    $SAFE/safekit printi "Apache started"
  fi
  return $retval
}
#----------------------------------------------------------
#            Main program for starting
#----------------------------------------------------------
#----------------------------------------------------------
#            Applications starting calls  
#----------------------------------------------------------
res=0
apache || res=$?
if [ $res -ne 0 ] ; then
  $SAFE/safekit printi "start_both failed"
 
  # uncomment to stop SafeKit when critical
  # $SAFE/safekit stop -i "start_both"
fi
exit 0
Step# 6 : cluseter test
  1. Load balance test
Select VIP.

Ensure that sessions are distributed on node1 and node2

  1. Fail over test  (Node 1 stop )


Stop the service and enter each server to ensure that 80 ports are serviced.
Below, we can see that only one node is serviced.



Web service can be confirmed that only one side is served. (node 2(svr2)

Step# 7: Safekit Replication Configuration



 
  1. Intall configure a new module => click


 
  1. Mirror safe  => click

  1. Make replication folder
[root@svr2 ~]# mkdir /DATA
[root@svr1 ~]# mkdir /DATA
  1. Edit the configuration TAB : Put in Virtual address  and path

  1. Apply the Configuration TAB

  1. Check Result TAB

  1. Finish TAB

  1. Mirro cluster start






 
  1. Configuration TAB srv1-> PRIMARY  svr2-> SECOND


Step# 7: Replication Configuration TEST
  1. DATA replication  TEST : Create the file on Svr1 and Check it  the file on SVR 2

  1. Change primary -> secondary  and secondary-> primary






Data replication is a one-way replication from primary to secondary.


















 
사업자 정보 표시
(주)블루원 | 김홍태 | 서울특별시 용산구 원효로 4가 135 금홍 2빌딩 | 사업자 등록번호 : 106-86-76684 | TEL : 02-3272-7200 | Mail : support_ora@blueone.co.kr | 통신판매신고번호 : 호 | 사이버몰의 이용약관 바로가기

+ Recent posts