달력

08

« 2009/08 »

  •  
  •  
  •  
  •  
  •  
  •  
  • 1
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  •  
  •  
  •  
  •  
  •  
2009/08/22 23:05

리눅스 메모리, swapping 관련 Linux2009/08/22 23:05

리눅스에서의 메모리 관리와 스와핑에 관한 관련글 링크





Posted by shsch
2009/08/15 09:35

RHEL5.3 에 sun jdk 1.6 버전 설치 Linux2009/08/15 09:35

RHEL Supplementary 에서 다음의 패키지를 다운로드 후 설치하면 된다.

java-1.6.0-sun-1.6.0.11-1jpp.1.el5.x86_64.rpm
java-1.6.0-sun-demo-1.6.0.11-1jpp.1.el5.x86_64.rpm
java-1.6.0-sun-devel-1.6.0.11-1jpp.1.el5.x86_64.rpm
java-1.6.0-sun-jdbc-1.6.0.11-1jpp.1.el5.x86_64.rpm
java-1.6.0-sun-plugin-1.6.0.11-1jpp.1.el5.i586.rpm
java-1.6.0-sun-src-1.6.0.11-1jpp.1.el5.x86_64.rpm

혹시 설치 중 의존성 에러가 난다면 아래 패키지도 깔아야함.

unixODBC-devel-2.2.11-7.1.i386.rpm
unixODBC-devel-2.2.11-7.1.x86_64.rpm

sun jdk 1.6 설치 전

[root@rhel5b ~]# java -version
java version "1.6.0"
OpenJDK  Runtime Environment (build 1.6.0-b09)
OpenJDK 64-Bit Server VM (build 1.6.0-b09, mixed mode)

sun jdk 1.6 설치 후

[root@rhel5b ~]# java -version
java version "1.6.0_11"
Java(TM) SE Runtime Environment (build 1.6.0_11-b03)
Java HotSpot(TM) 64-Bit Server VM (build 11.0-b16, mixed mode)
TAG Java, jdk, rhel5
Posted by shsch
RHN에서 DVD 이미지 다운로드 (rhel-server-5.3-x86_64-dvd.iso)
# mkdir /repo
# mount -o loop rhel-server-5.3-x86_64-dvd.iso /mnt
# cd /mnt; cp -a * /repo
# cd /repo; createrepo .
/etc/yum.repos.d 디렉토리 아래에 dvd.repo 파일 작성
[dvd]
mediaid=1231287803.932941
name=DVD for RHEL5
baseurl=file:///mnt/iso/Server
enabled=1
gpgcheck=0

[dvd-cluster]
mediaid=1231287803.932941
name=DVD for RHEL5 - Cluster
baseurl=file:///mnt/iso/Cluster
enabled=1
gpgcheck=0

[dvd-cluster-storage]
mediaid=1231287803.932941
name=DVD for RHEL5 - ClusterStorage
baseurl=file:///mnt/iso/ClusterStorage
enabled=1
gpgcheck=0

[dvd-vt]
mediaid=1231287803.932941
name=DVD for RHEL5 - VT
baseurl=file:///mnt/iso/VT
enabled=1
gpgcheck=0 
다른 클라이언트 시스템에서 웹으로 사용할 수 있도록 하기 위해서는
# cd /var/www/html
# ln -s /repo
# service httpd start

클라이언트 설정은 /etc/yum.repos.d 디렉토리 아래에 repo 파일을 만듬
[RH53-Server]
name= RHEL 5.3 Server Repository
baseurl=http://192.168.123.133/repo/Server
enabled=1
gpgcheck=0

[RH53-Cluster]
name= RHEL 5.3 Cluster Repository
baseurl=http://192.168.123.133/repo/Cluster
enabled=1
gpgcheck=0

[RH53-ClusterStorage]
name= RHEL 5.3 ClusterStorage Repository
baseurl=http://192.168.123.133/repo/ClusterStorage
enabled=1
gpgcheck=0

[RH53-vt]
name= RHEL 5.3 VT Repository
baseurl=http://192.168.123.133/repo/VT
enabled=1
gpgcheck=0
TAG ISO, Repo, yum
Posted by shsch
2009/08/09 20:15

piranha 를 이용한 fail over 구성 Linux2009/08/09 20:15

hearbeat 을 이용한 것과 동일하게 Fail Over를 구성하는데 RHEL 5.3 Cluster Suite  에 포함되어 있는 piranha 패키지를 사용하는 방법을 간단히 정리해 보면...

1. RHEL 5.3 DVD 안에 Cluster 디렉토리에 들어있는 piranha 패키지 설치

(의존성이 어떻게 걸려있을지 몰라 DVD 이미지를 사용하여 yum repository 로 구성하여 yum gruopinstall Clustering 명령으로 Cluster 관련 패키지 전체를 설치함)

2. piranha 설정

웹접속

- piranha-passwd  명령으로 패스워드 설정
- service piranha_gui start 실행
- http://localhost:3636 으로 접속 (ID: piranha, Password 입력)

직접수정

/usr/share/doc/piranha-0.8.4/sampl.cf 파일을 복사 후 수정하여 /etc/sysconfig/ha/lvs.cf
로 저장

service = fos
primary = 192.168.123.122
backup = 192.168.123.121
backup_active = 1
heartbeat = 1
heartbeat_port = 539
keepalive = 6
deadtime = 18
network = direct
debug_level = NONE

failover web {
     active = 1
     address = 192.168.123.150 eth0:1
     vip_nmask = 255.255.255.255
     port = 80
     send = "GET / HTTP/1.0\r\n\r\n"
     expect = "HTTP"
     timeout = 10
     start_cmd = "/etc/rc.d/init.d/httpd start"
     stop_cmd = "/etc/rc.d/init.d/httpd stop"
}


failover ftp {
     active = 1
     address = 192.168.123.150 eth0:1
     vip_nmask = 255.255.255.255
     port = 21
     send = "\n"
     timeout = 10
     start_cmd = "/etc/rc.d/init.d/vsftpd start"
     stop_cmd = "/etc/rc.d/init.d/vsftpd stop"
}


3. lvs.cf 는 양쪽 시스템 모두 동일해야 하고 마지막으로 'service pulse start' 실행

(이 때 에러가 발생한다면 대부분 lvs.cf 설정 파일의 문제임...)

길게 테스트 해보지는 못했지만 primary 서버의 네트워크 접속이 끊기면 backup 서버로 자동 연결되었다가 primary 네트워크가 살아나도 서비스는 옮겨오지 않는다. backup 서버에 문제가 생길 경우 ip와 서비스가 primary 로 넘어옴. (뭔가 구성이 잘못된 건지 원래 그런건지...??)


개인적으로는 이런 단순한 Fail Over 구성시에는 heartbeat 이 훨씬 사용하기 쉽고 잘 작동하는 듯하다.


Posted by shsch
2009/08/08 08:28

패스워드 입력없이 ssh 로그인 하기 Linux2009/08/08 08:28

rhel5a 시스템의 testuser 계정으로 rhel5b 시스템의 testuser1 계정으로 ssh 로 로그인 하는데 패스워드 입력없이 로그인 하는 방법.

1. rhel5a 에서  키생성 (그냥 엔터키만 누르고 진행)

[testuser@rhel5a ~]$ ssh-keygen -t dsa
Generating public/private dsa key pair.
Enter file in which to save the key (/home/testuser/.ssh/id_dsa):
Created directory '/home/testuser/.ssh'.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/testuser/.ssh/id_dsa.
Your public key has been saved in /home/testuser/.ssh/id_dsa.pub.
The key fingerprint is:
4d:bd:bc:b9:92:bf:eb:22:a8:5a:af:14:de:41:ad:a2 testuser@rhel5a

2. rhel5b의 testuser1 계정으로 키 복사

[testuser@rhel5a ~]$ ssh-copy-id -i .ssh/id_dsa.pub testuser1@rhel5b
15
The authenticity of host 'rhel5b (192.168.123.121)' can't be established.
RSA key fingerprint is 02:c1:b0:19:9e:10:0f:00:f9:a2:95:9e:3b:60:3e:d4.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'rhel5b,192.168.123.121' (RSA) to the list of known hosts.
testuser1@rhel5b's password:
Now try logging into the machine, with "ssh 'testuser1@rhel5b'", and check in:

  .ssh/authorized_keys

to make sure we haven't added extra keys that you weren't expecting.

3. 원격 접속 확인 

[testuser@rhel5a ~]$ ssh testuser1@rhel5b
Last login: Sat Aug  8 08:19:14 2009 from rhel5a
Posted by shsch
2009/08/07 21:45

IP Bonding 설정 Linux2009/08/07 21:45

RHEL 5.3 에서 IP Bonding 설정

1. /etc/modprobe.conf

  alias bond0 bonding
 
2. /etc/sysconfig/network-scripts/ifcfg-bond0

  DEVICE=bond0
  IPADDR=192.168.50.111
  NETMASK=255.255.255.0
  USERCTL=no
  BOOTPROTO=none
  ONBOOT=yes
  BONDING_OPTS="mode=0 miimon=100"

mode 0 : round robin
mode 1 : active / backup

(mode 1로 구성시 primary=eth0 옵션 추가 가능 : primary 인터페이스가 정상으로 돌아오면 그 인터페이스를 자동으로 사용하게 된다 )

사용 가능한 모드에 대한 설명

3. /etc/sysconfig/network-scripts/ifcfg-ethX

  DEVICE=ethX
  USERCTL=no
  ONBOOT=yes
  MASTER=bond0
  SLAVE=yes
  BOOTPROTO=none

4. 재부팅

* bonding 상태 확인 : /proc/net/bonding/bond0
 
TAG bonding
Posted by shsch
2009/08/07 20:20

간단한 heartbeat 사용 방법 Linux2009/08/07 20:20

갑자기 작업할 건이 생겨서...제 대로 된 HA 구성은 아니지만 간단하게 정리해 본다.

테스트 조건 및 환경

- L2 스위치 아래 리눅스 서버 두 대가 있는데 Active/Standby 형태로 구성하여 한 대의 서버에 문제가 생겼을 경우에도 서비스를 지속적으로 할 수 있어야 한다.
- 구성 서비스 : 어떤 서비스를 할 것 인지 모른다. 그래서 IP 주소를 넘겨주는 것만 테스트함
- 공유 데이터 없음.
- 리눅스 서버는 각가 NIC 2개를 bonding으로.. 서비스 NIC와 heartbeat 용 NIC를 같이 사용함


 VIP : 192.168.123.150
 rhel5a : 192.168.123.120
 rhel5b : 192.168.123.121

OS버전 : RHEL 5.3

이렇게 구성하면 외부에서는 192.168.123.150 로 접속하면 rhel5a 서버로 연결이 되고 rhel5a 서버가 다운되었을 경우에는 rhel5b 서버로 연결된다.

1. hearbeat 설치

설치할 프로그램

heartbeat-2.1.4-4.1.x86_64.rpm
heartbeat-pils-2.1.4-4.1.x86_64.rpm
heartbeat-stonith-2.1.4-4.1.x86_64.rpm


설치

# rpm -ivh heartbeat-2.1.4-4.1.x86_64.rpm heartbeat-pils-2.1.4-4.1.x86_64.rpm heartbeat-stonith-
2.1.4-4.1.x86_64.rpm

2. hearbeat 설정

환경설정 파일 복사

# cp /usr/share/doc/packages/heartbeat/ha.cf /etc/ha.d
# cp /usr/share/doc/packages/heartbeat/authkeys /etc/ha.d
# cp /usr/share/doc/packages/heartbeat/haresources /etc/ha.d

[root@rhel5a ha.d]# grep -v '^#' ha.cf
logfile /var/log/ha-log
logfacility local0
keepalive 2
deadtime 30
udpport 694
bcast  bond0 # Linux
auto_failback on
node rhel5a
node rhel5b

[root@rhel5a ha.d]# grep -v '^#' haresources
rhel5a 192.168.123.150

[root@rhel5a ha.d]# grep -v '^#' authkeys
auth 1
1 md5 Hello!

- authkeys 파일 퍼미션은 600으로 설정
- rhel5b 에도 동일하게 설정

추후에 공유할 서비스는 /etc/ha.d/haresources 디렉토리 아래에 두면 된다.

서비스 등록 : chkconfig --add heartbeat

참고문서



Posted by shsch
2009/08/06 19:00

Gnome에서 Print Screen Key 사용 막는 방법 Linux2009/08/06 19:00

이게 왜 필요한지 모르겠으나 요청하는 사람이 있어서 간단히 정리해 본다. (RHEL 4.7기준)

원래 Gnome 에서 PrintScreen key 를 누르면 화면을 캡쳐하게 된다.

사용자 삽입 이미지

그러나 PrintScreen Key 입력시 아무런 작동도 안되게 하려면

 'Applications ->Preferences->Keyboard Shortcuts' 메뉴를 클릭

사용자 삽입 이미지

'Take a screenshot 항목을 더블 클릭 후 백스페이스 키를 누르면 Disabled 로 변경된다.


사용자 삽입 이미지




Posted by shsch
2009/08/02 22:51

RHEL3 DVD 이미지 만들기 Linux2009/08/02 22:51

최근에 나오는 RHEL4, 5 버전은 DVD 이미지로 제공되나 예전 버전인 RHEL3 버전은 CD 이미지로만
제공되고 있어 조금 불편한 편이다.

이 CD 이미지를 DVD로 이미지로 변환하는 간단한 방법이다.

아래의 mkdvdiso.sh 스크립트를 다운로드 받은 후
다름과 같은 명령을 실행


# ./mkdvdiso.sh source /destination/DVD. iso

여기서 source 는 cd 이미지가 들어있는 디렉토리이며 그 뒤는 만들 DVD iso 파일이 저장될 위치와 이름을 지정하면 된다.

Posted by shsch