2024년 4월 26일 금요일

Mac 설치하고 처음에 설치해햐는 작업들



ohmyzsh 설치 매번 맥 깔고 할때마다 찾기 귀찬음을 방지하고자 설치하는 것들을 적어놓는다.

맥 처음 깔면설치하는것 

iterm 그리고 ohmyzsh

먼저 iterm 을 다운로드받는다.

https://iterm2.com/ 

그런후 ohmyzsh 를 다운받아 설치한다.

 sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"

처음 설치하면 위와같은 화면이 나오는데 enter 를 누르면된다.
역시 한번에 되는것은 없다. 
git을 설치해준다.



설치하려니 Homebrew 를 설치해줘야한다.

https://brew.sh/

접속해서 정보를 확인해서 설치한다.

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"


command line tool 도 알아서 설치해준다.

설치되고 나면 아래와 같은 설정을 해줘야 한다고한다.

    (echo; echo 'eval "$(/opt/homebrew/bin/brew shellenv)"') >> /Users/dicky/.zprofile

    eval "$(/opt/homebrew/bin/brew shellenv)"

되고나면 git 을 설치해준다.

brew install git

설치되고 나면 다시 ohmyzsh 설치 하면 된다.

 sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"


프롬프트에 유저정보하고, 서버이름설정


```
vi ~/.oh-my-zsh/themes/robbyrussell.zsh-theme

PROMPT='%{$fg_bold[blue]%}%n@%m%{$reset_color%}%{$fg[blue]%}|%(?:%{$fg_bold[green]%}➜ :%{$fg_bold[red]%}➜ )%{$fg_bold[cyan]%} %c%{$reset_color%} $(git_prompt_info)'

```






2024년 1월 23일 화요일

Java 로 gmail을 이용해서 SMTP 메일 보내는 방법


 간단하게 SMTP로 메일 보내는 방법을 기술한다.

보안적으로 약간은 부족할수있다.

먼져 설정해야 할것은 Gmail 설정을 해줘야 한다.

1. 앱 비밀번호 만들기

구글 계정에 로그인하여 보안을 선택해준다.

로그인하는 방법에서 2단계 인증을 추가해준다.





2단계 인증절차를 진행해준다.
설정을 완료하면 2단계 인증 설정이 완료된다.
다시 2단계 인증화면으로 들어가 하단에 앱비밀번호를 설정해준다.




앱 이름을 적어주고 앱비밀번호를 설정해준다.
















16자리 비밀번호를 잘 저장해놓는다. (한번생성되면 확인불가)
생성된 앱정보를 확인 가능하다.








그럼 중요한 코드
Java maven 을 기준으로 하면 먼져 의존성을 추가해주고 코드를 작성하면 끝난다.

pom.xml 파일에 추가해준다.
```
<!-- Gmail -->
<dependency>
<groupId>javax.mail</groupId>
<artifactId>javax.mail-api</artifactId>
<version>1.6.2</version>
</dependency>
<dependency>
<groupId>com.sun.mail</groupId>
<artifactId>javax.mail</artifactId>
<version>1.6.2</version>
</dependency>
```
application.properities 에 mail 정보를 기입해준다.

```
#gmail
email.user=email
email.password=password
email.smtp.host=smtp.gmail.com
email.smtp.port=465
```

메일 작성코드를 작성해준다.
```
package com.shop.controller;

import java.util.Properties;
import javax.mail.*;
import javax.mail.internet.InternetAddress;
import javax.mail.internet.MimeMessage;

public class EmailSender {
private Properties emailConfig;

public EmailSender() throws Exception {
this.emailConfig = loadEmailConfig();
}

private Properties loadEmailConfig() throws Exception {
Properties props = new Properties();
// application.properties 파일을 로드합니다.
props.load(Thread.currentThread().getContextClassLoader().getResourceAsStream("application.properties"));
return props;
}

public void sendEmail(String recipient, String subject, String text) throws MessagingException {
Properties props = createEmailProperties();
Session session = createSession(props);

Message message = new MimeMessage(session);
message.setFrom(new InternetAddress(emailConfig.getProperty("email.user")));
message.setRecipients(Message.RecipientType.TO, InternetAddress.parse(recipient));
message.setSubject(subject);
message.setText(text);

Transport.send(message);
}

private Properties createEmailProperties() {
Properties props = new Properties();
props.put("mail.smtp.host", emailConfig.getProperty("email.smtp.host"));
props.put("mail.smtp.port", emailConfig.getProperty("email.smtp.port"));
props.put("mail.smtp.auth", "true");
props.put("mail.smtp.ssl.enable", "true");
props.put("mail.smtp.ssl.trust", emailConfig.getProperty("email.smtp.host"));
return props;
}

private Session createSession(Properties props) {
return Session.getInstance(props, new javax.mail.Authenticator() {
protected PasswordAuthentication getPasswordAuthentication() {
return new PasswordAuthentication(emailConfig.getProperty("email.user"), emailConfig.getProperty("email.password"));
}
});
}

public static void main(String[] args) {
try {
EmailSender sender = new EmailSender();
sender.sendEmail("testemailaddress@gmail.com", "테스트 메일입니다.", "이것은 테스트 메일입니다. \n\n 잘 갔나요?");
} catch (Exception e) {
e.printStackTrace();
}
}
}
```

2021년 3월 31일 수요일

docker mysql 대문자테이블관련


대문자 테이블을 생성했다가 삭제하면 

xxxx doesn't exist 가 자주떠서 도커를 재실행하곤 했음.

일반설정변경하려면 my.cnf 파일 변경하면되는데 도커라..

그래서 아래와 같이 실행시 옵션을 주면됨.


시작할대 옵션변경하려면

-- lower_case_table_names=1 과 같이 주면된다.


```

 docker run -d -p 3306:3306 \

--restart always \

-e MYSQL_ROOT_PASSWORD=dicky \

--name mysql \

mysql:5.7 --lower_case_table_names=1

```

2021년 3월 11일 목요일

[jmeter]response log

400 일경우 성공하게


 if (prev.getResponseCode().equals('400')) {

    prev.setSuccessful(true)

}


http 응답에대한 로그

log.info("Responsestamp = " + prev.getTimeStamp());

log.info("Response = " + prev.getResponseCode());

log.info("Responseage = " + prev.getResponseMessage());

log.info("Responseers =  " + prev.getResponseHeaders());

log.info("Responseng = " + prev.getResponseDataAsString());


참고글

https://lobsterautomation.wordpress.com/tag/beanshell/

2021년 1월 13일 수요일

[jenins] docker 로 jenkins 설치

docker 로 jenkins 설치하기

먼저 docker 를 받아온다.

공식 docuer hub  에 들어가면 자세히 나옴

아래내용만 봐도 알겠지만. 

https://hub.docker.com/_/jenkins?tab=tags&page=1&ordering=last_updated

docker pull jenkins 

호스트에 있는 디렉토리 볼륨연결을 위한 디렉토리 생성

mkdir -p /tools/jenkins/jenkins_home

실행

docker run -d --name jenkins -p 80:8080 -p 50000:50000 -v /tools/docker/jenkins/jenkins_home:/var/jenkins_home \
  -u root -e JAVA_OPTS='-Duser.timezone=Asia/Seoul -Dfile.encoding=UTF-8 -Dsun.jnu.encoding=UTF-8' jenkins

2020년 11월 17일 화요일

그냥 맥에깔아서쓰고있는것들.

그냥 쓰는 프로그램들 맥에서.
 zsh iterm vscode sourcetree sequql pro postman jmeter joplin


zsh관련 설정
https://blog.outsider.ne.kr/1490


원하는곳에 요것만깔아주고 zsh 설정하고, iterm 재시작
git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ~/powerlevel10k
echo 'source ~/powerlevel10k/powerlevel10k.zsh-theme' >>! ~/.zshrc


화면분할 무료 https://www.spectacleapp.com/ 
유료 https://apps.apple.com/app/id441258766?mt=12 

클립보드 https://github.com/Clipy/Clipy
요건 다른사람이 올린거. https://macnews.tistory.com/3815


2020년 11월 11일 수요일

blogspot code formatter

http://codeformatter.blogspot.com/ 되나?
<pre><code class="language-java">/* CallingMethodsInSameClass.java
 *
 * illustrates how to call static methods a class
 * from a method in the same class
 */

public class CallingMethodsInSameClass
{
    public static void main(String[] args) {
        printOne();
    }

    public static void printOne() {
        System.out.println("Hello World");
    }
}</code></pre>

Protocol Buffers 파일을 조금 보기쉽게 변환해보기

사내에서 Protocol Buffers  를 사용해서 프로토콜을 정의해서쓰고있어서.. 

찾아보니 아래와 같은 github 이 있음.


https://github.com/pseudomuto/protoc-gen-doc

들어가서 찬찬히 읽어보니.

설치는 아래와같이.

go get -u github.com/pseudomuto/protoc-gen-doc/cmd/protoc-gen-doc


실행하려고하니.

protoc --plugin=/Users/dicky/go/bin/protoc-gen-doc

식으로해야해서 


shell 로 만들어봄.


```

imgFile=$1

name=`basename $imgFile`

fileName="${name%.*}"

fileExtension="${name##*.}"

echo $name

echo $fileName

echo $fileExtension

protoc --plugin=/Users/dicky/go/bin/protoc-gen-doc --doc_out=./doc --doc_opt=html,$fileName.html $1

open ./doc/$fileName.html

```

그래서 실행은

./gen /server/SignIn.proto


그래서 결과물은 html 로 보기쉽게 나옴.



2020년 11월 10일 화요일

[QA] Jmeter json Extractor

Jmeter 에서 response 에대해서 추출 할때 Json Extractor를 사용한다.

json 값이 아래와 같을때

{

    "accessToken": "aabbccdd-ddkksskk-aaddvvc-edqadfasd",

    "memberId": "AB45518383"

}

- accssToken 값은 $.accessToken

- memberId 값은 $.memberId

아래와 같이 할 수 있다.







참고적으로 Postman에서 할려면.





참고

https://goessner.net/articles/JsonPath/

https://octoperf.com/blog/2017/03/09/how-to-extract-data-from-json-response-using-jmeter/


-전반적이 가이드는 아래것을 보면됨.

https://octoperf.com/blog/2018/04/23/jmeter-rest-api-testing/




2020년 11월 9일 월요일

[QA] Postman 참고될만한 SNIPPETS

Postman 참고될만한 SNIPPETS

SNIPPETSTests Code설명
Get an environment variablepm.environment.get("variable_key");Postman 전체에서 사용 가능한 파라미터 값 얻음
Get a global variablepm.globals.get("variable_key");전역 파라미터 값 얻기
Get a variablepm.variables.get("variable_key");Collection 안에서 사용 가능한 파라미터 값 얻기
Set an environment variablepm.environment.set("variable_key", "variable_value");Postman 전체에서 사용 가능한 파라미터 값 설정
Set a global variablepm.globals.set("variable_key", "variable_value");전역 파라미터 값 설정
Clear an environment variablepm.environment.unset("variable_key");Postman 전체에서 사용 가능한 파라미터 삭제
Clear a global variablepm.globals.unset("variable_key");전역 파라미터 삭제
Send a requestpm.sendRequest("https://postman-echo.com/get", function (err, response) {
console.log(response.json());
});
API 호출
Status code: Coet is 200pm.test("Status code is 200", function () {
pm.response.to.have.status(200);
});
Http 코드가 200인지 확인
Response body: Contains stringp[m.test(](http://m.test()"Body matches string", function () {

pm.expect(pm.response.text()).to.include(;
});
응답 결과 중 원하는 단어 포함 여부 확인
Response body: Is equal to a stringp[m.test(](http://m.test()"Body is correct", function ()

{pm.response.to.have.body("response_body_string");
});
응답 결과가 원하는 결과인지 확인
Response headers: Content-Type header checkpm.test("Content-Type is present", function () {
pm.response.to.have.header("Content-Type");
});
응답 header 중 원하는 타입이 있는지 확인함.
Response time is less than 200msp[m.test(](http://m.test()"Response time is less than 200ms", function () {


pm.expect(pm.response.responseTime).to.be.below(200);
});
응답 시간이 200ms이하인지 확인
Status code: Successful POST requestpm.test("Successful POST request", function () {

pm.expect(pm.response.code).to.be.oneOf([201,202]);
});
http 코드가 201, 202 중 하나인지 확인
Status code: Code name has stringpm.test("Status code name has string", function () {
pm.response.to.have.status("Created");
});
응답 코드에 원하는 단어 포함 여부 확인
Response body: Convert XML body to a JSON Objectvar jsonObject = xml2Json(responseBody);XML을 JSON으로 변환
Use Tiny Validator for JSON datavar schema = {
"items": {
"type": "boolean"
}
};

var data1 = [true, false];
var data2 = [true, 123];

pm.test('Schema is valid', function() {
pm.expect(tv4.validate(data1, schema)).to.be.true;
pm.expect(tv4.validate(data2, schema)).to.be.true;
});
응답 값인 JSON 데이터데 원하는 Schema 여부 확인
참고 
https://m.blog.naver.com/wisestone2007/221393509035
https://learning.postman.com/docs/sending-requests/variables/



2020년 6월 19일 금요일

신용카드 번호 체계(BIN)와 검증번호

신용카드와 체크카드 번호는 XXXX-XXXX-XXXX-XXXX 형식으로 4자리씩 총 16자리로 구성된다. 아멕스 신용카드 처럼 일부 카드는 15자리도 있지만 대부분은 16자리이다.
이 중에서 앞자리 6개는 국제식별번호이며 BIN (Bank Identification Number) 이라고 부른다.

국내 신용카드사 전체의 6자리 BIN 넘버를 알고 싶으면, VAN사 자료실에서 찾아보면 된다

전세계 BIN 정보는 아래



참고

2017년 2월 16일 목요일

HAproxy HA 구성


HA 구성을 봐야해서 남겨둔다.

물론인터넷에서 가져옴. 문제될까봐 출처도 남겨놓는다.

https://blog.logentries.com/2014/12/keepalived-and-haproxy-in-aws-an-exploratory-guide/

HAproxy는 고가용성 프록시를 의미합니다. 
이름에서도 알 수 있다시피 High Availability proxy 입니다
C 언어로 작성되었으며 무료 오픈소스 프로그램입니다. 
HAproxy는 TCP / HTTP 로드 밸런서로 프록시 솔루션에 사용됩니다. 
HAproxy의 일반적인 용도는 웹서버, DB 서버 등 부하를 분산시키는 용도로 많이 사용되고 있습니다.
BSD, 리눅스, 솔라리스 등에서 사용할 수 있으며, 물론 윈도우는 안됩니다. (-0-;)
(여담이지만, 윈도우는 뭐 다 돈이네요 ;;;)

**********************************************************************************************************
* 환경
OS : Ubuntu 16.04.1 LTS
HAproxy : 1.6.7
WebServer : Apache/2.4.18 (Ubuntu)
VM : VirtualBox 5.1.2

* 참고
sudo 로 진행하지 않고 root 로 진행합니다.
**********************************************************************************************************
* 준비사항
VM 환경에서 진행되며, 로드밸런서이기 때문에
HAproxy 를 설치할 VM 하나, 웹서버 VM 2개를 먼저 준비합니다.
VM 을 만드는 부분은 여기서 설명하지 않습니다.
VM 의 상세 내역은 아래와 같습니다.

VM
OS
IP
Hostname
HAproxy
Ubuntu 16.04.1 LTS 64bit
172.16.1.5
HAproxy
 Webserver01
Ubuntu 16.04.1 LTS 64bit
172.16.1.15
webserver-01
Webserver02
Ubuntu 16.04.1 LTS 64bit
172.16.1.16
webserver-02

**********************************************************************************************************

1. Apache 설치
# apt-get install apache2 
  - 모든 VM 에 apache 를 모두 설치합니다.

2. HAproxy 저장소 등록 및 업데이트
# apt-add-repository ppa:vbernat/haproxy-1.6
# apt-get update

3. HAproxy 설치
# apt-get install haproxy

4. haproxy.cfg 수정
# vi /etc/haproxy/haproxy.cfg

global
        #log /dev/log   local0
        #log /dev/log   local1 notice
        log 127.0.0.1 local2
        chroot /var/lib/haproxy
        stats socket /run/haproxy/admin.sock mode 660 level admin
        stats timeout 30s
        user haproxy
        group haproxy
        daemon
 . . .

위처럼 log 를 주석처리 해주고 log 127.0.0.1 local2 를 입력해 줍니다.

5. rsyslog.conf 파일 수정
# vi /etc/rsyslog.conf

$ModLoad imudp
$UDPServerRun 514 

파일에 위 부분이 주석처리 되어 있다면 주석을 풀어주시고 없다면 입력해 줍니다.

6. haproxy.conf 파일 생성하고 내용 추가
# vi /etc/rsyslog.d/haproxy.conf

local2.*        /var/log/haproxy.log

7. rsyslog 서비스 재시작
# service rsyslog restart

8. haproxy.cfg 수정
# vi /etc/haproxy/haproxy.cfg

defaults
        log     global
        mode    http
        option  httplog
        option  dontlognull
        option  http-server-close
        option  forwardfor except 127.0.0.0/8
        option  redispatch
        retries 3
        timeout http-request    20
        timeout queue            86400
        timeout connect          86400
        timeout client             86400
        timeout server             86400
        timeout http-keep-alive 30
        timeout check             20
        maxconn                    50000 

frontend LB
        bind 172.16.1.5:80
        reqadd X-Forwarded-Proto:\ http
        default_backend bkLB

backend bkLB
        mode http
        stats enable
        stats hide-version
        stats uri /stats
        stats realm Haproxy\ Statistics
        stats auth haproxy:admin
        balance roundrobin
        option httpchk
        option httpclose
        option forwardfor
        cookie LB insert
        server webserver-01 172.16.1.15:80 cookie webserver-01 check
        server webserver-02 172.16.1.16:80 cookie webserver-02 check


10. HAproxy 재시작
# service haproxy restart

11. 시스템 시작시 자동으로 시작하기 위해 파일 수정
# vi /etc/default/haproxy

ENABLED=1 


12. 정상적으로 동작하는지 확인하기 위해 웹서버 index.html 를 수정
- webserver-01 에서
# mv /var/www/html/index.html /var/www/html/index.html.backup
# vi /var/www/html/index.html
webserver-01 

- webserver-02 에서
# mv /var/www/html/index.html /var/www/html/index.html.backup
# vi /var/www/html/index.html
webserver-02

13. 로드밸런싱이 되는지 확인
# curl 172.16.1.5
webserver-01
# curl 172.16.1.5
webserver-02
# curl 172.16.1.5
webserver-01
# curl 172.16.1.5
webserver-02

위 처럼 roundrobin 형식으로 정상적으로 나오는지 확인

14. HAproxy 통계 페이지 확인
- 웹브라우저에서 172.16.1.5/stats 를 입력
  로그인 화면에서 haproxy / admin 으로 로그인





* 참고
hosts 파일 수정

127.0.0.1       localhost
127.0.1.1       HAproxy

# The following lines are desirable for IPv6 capable hosts
::1     localhost ip6-localhost ip6-loopback
ff02::1 ip6-allnodes
ff02::2 ip6-allrouter

172.16.1.15  webserver-01
172.16.1.16  webserver-02 


출처: http://livegs.tistory.com/43 [if (feel)]

실제 현업에선 HAproxy 한대로 구성하는 경우는 거의 없습니다.
만약 HAproxy 가 장애를 일으켜 죽는 경우가 발생하면
그 밑에 있는 웹서버들은 다 죽는 거나 마찬가지기 때문에 리스크가 너무 큽니다.
그래서, 이번엔 HAproxy 를 Active - Standby 형식으로 LB Cluster 를 구성해 보겠습니다.
HAproxy 를 HA 구성으로 만들기 위해 keepalived 를 이용하여 구성합니다.
**********************************************************************************************************
* Keepalived 란?
Keepalived 는 C 언어로 작성되었으며 부하 분산 및 고가용성을 위한 라우팅 소프트웨어입니다.
VRRP (Virtual Router Redundancy Protocol) 프로토콜을 사용합니다.
VRRP 관련하여 알고 싶으시면 여기 를 확인해 보시기 바랍니다.

**********************************************************************************************************
* 환경
OS : Ubuntu 16.04.1 LTS
HAproxy : 1.6.7
Keepalived : 1.2.19

* 참고
sudo 로 진행하지 않고 root 로 진행합니다.
**********************************************************************************************************
* 준비사항

VM
OS
IP
Hostname
HAproxy
Ubuntu 16.04.1 LTS 64bit
172.16.1.5
HAproxy
HAproxy2
Ubuntu 16.04.1 LTS 64bit
172.16.1.6
HAproxyB
 Webserver01
Ubuntu 16.04.1 LTS 64bit
172.16.1.15
webserver-01
Webserver02
Ubuntu 16.04.1 LTS 64bit
172.16.1.16
webserver-02

HAproxy 에서 설치했던 것과 같이 똑같이 HAproxyB 에도 설치합니다.
설치하는 방법은 이전 포스팅 http://livegs.tistory.com/43 을 참고해주세요.

**********************************************************************************************************

1. HAproxy 가 설치된 서버의 커널 값을 수정합니다. (두 대 모두 수행)
# vi /etc/sysctl.conf
 net.ipv4.ip_nonlocal_bind=1

위 부분이 중요한 부분인데, 위 옵션이 뭔지 찾아보면
로컬 IP 가 아닌 주소에 bind() 할 수 있게 해줍니다. 라고 되어 있는데요. 말이 어려운데요.
다시 말해서 현재 가지고 있는 IP 가 아닌 다른 외부 IP 를 NIC 에 바인딩 할 수 있게 해준다는 뜻입니다.
이게 왜 중요하냐면 서비스인 VIP 를 첫번째 서버가 가지고 있다가 장애가 나는 경우
Standby 서버로 그 VIP 를 옮겨야 서비스가 끊기지 않고 돌아갈 수 있기 때문이죠.
저 옵션이 되어 있지 않은 경우 VIP 를 바인딩 할 수 없기 때문에 꼭 수정해줘야 합니다.

2. 커널 값 적용 및 확인 (두 대 모두 수행)
# sysctl -p
# cat /proc/sys/net/ipv4/ip_nonlocal_bind 

위 처럼 1이 나오면 정상적으로 적용됨.
안되는 경우 reboot


3. Keepalived 설치 (두 대 모두 수행)
# apt-get install keepalived

4. keepalived.conf 파일 수정
# vi /etc/keepalived/keepalived.conf

- 첫번째 서버
global_defs {
        router_id HAproxy
}

# Define the script used to check if haproxy is still working
vrrp_script chk_haproxy {
        script "killall -0 haproxy"
        interval 2
        weight 2
}

# Configuration for the virtual interface
vrrp_instance VIS_1 {

        interface              enp0s3
        state                   MASTER
        priority                101
        virtual_router_id     51
        advert_int             1

        # The virtual ip address shared between the two loadbalancers
        virtual_ipaddress {
                172.16.1.5
        }

        # Use the script above to check if we should fail over
        track_script {
                chk_haproxy
        }
}

- 두번째 서버
global_defs {
        router_id HAproxyB
}

# Define the script used to check if haproxy is still working
vrrp_script chk_haproxy {
        script "killall -0 haproxy"
        interval 2
        weight 2
}

# Configuration for the virtual interface
vrrp_instance VIS_1 {

        interface              enp0s3
        state                   MASTER
        priority                100
        virtual_router_id     51
        advert_int             1

        # The virtual ip address shared between the two loadbalancers
        virtual_ipaddress {
                172.16.1.5
        }

        # Use the script above to check if we should fail over
        track_script {
                chk_haproxy
        }
}


위 처럼 인스턴스 (vrrp_instance VIS_1) 이름은 동일하게 하며 priority 값은 다르게 하여
Master 가 내려 갔다 다시 올라오는 경우에 원래대로 Master 에서 VIP 를 가져갈 수 있게 합니다.
위 설정 값은 기본 적은 설정으로 자세한 옵션은 상황에 맞게 진행하면 됩니다.
더 자세한 내용을 알고 싶으면 여기 를 참고해 주세요.

5. keepalived 와 HAproxy 서비스 재시작 (두 대 모두 수행)
# service keepalived restart
# service haproxy restart

6. IP 할당 확인
# ip addr show
위 명령어로 확인해보면 첫번째 서버의 NIC 에 VIP가 추가로 할당되어 있는 것을 확인할 수 있다.

7. FailOver 확인
두 대의 서버가 아닌 서버에서 (같은 네트워크에 있는...) ping 으로 확인해 봅니다.

# ping 172.16.1.5

수행 후 첫번 째 서버를 halt 내지는 poweroff 를 해봅니다.

...

64 bytes from 192.168.25.203: icmp_seq=221 ttl=64 time=0.291 ms
64 bytes from 192.168.25.203: icmp_seq=222 ttl=64 time=0.297 ms
64 bytes from 192.168.25.203: icmp_seq=223 ttl=64 time=0.242 ms
64 bytes from 192.168.25.203: icmp_seq=224 ttl=64 time=0.286 ms
64 bytes from 192.168.25.203: icmp_seq=225 ttl=64 time=0.151 ms
64 bytes from 192.168.25.203: icmp_seq=226 ttl=64 time=0.270 ms 

...


위 처럼 ping 이 가다가 잠시 순단 현상이 발생할 수 있으나 계속 ping 이 나간다면
정상적으로 failover 됨을 알 수 있습니다.
실제 두번째 서버에 가서 
# ip addr show 를 해보면 VIP 인 172.16.1.5 가 NIC 에 바인딩 되어 있음을 확인할 수 있습니다.


출처: http://livegs.tistory.com/44 [if (feel)]