가끔씩 fstab 잘못된 Block Device 정보를 등록하거나, 디스크가 Lable 또는 정보가 변경되어 정상적인 부팅이 되지 않고 Repair Filesystem 모드로 들어가는 경우가 생긴다.

물론 fstab 수정하고 재부팅하면 빠르게 처리가 되지만, Repair Filesystem 상태에서는 Read Only 상태로 마운트가 되기 때문에 수정이 불가능 하다.


이때
아래와 같이 최상위 Root 파티션인 / Read/Write 모드로 다시 마운트 하면 쉽게 수정하여 재부팅을 진행 있다.

 

Repair filesystem # mount -w -o remount /
Repair filesystem
# vi /etc/fstab
--- fstab 내용 수정 후 ---
Repair filesystem
# reboot
저작자 표시 비영리
Posted by 마성민
- 사건 개요 
  > Centos 6 설치 이후 lftp를 사용하려 하자, 아래와 같은 에러메세지가 출력되면서 동작을 하지 않음.
/usr/lib64/libgnutls.so.26: symbol gcry_cipher_setkey, version GCRYPT_1.2 not defined in file libgcrypt.so.11 with link time reference

     구글이랑 여러군데 검색을 해본 결과 gcrypt 설치 이후 라이브러리 경로가 /usr/lib으로 되어 있을 수 있으나, ldconfig에 해당 내용을 추가하면 될 것이라는 내용을 확인.
이에 아래와 같이 /etc/ld.so.conf에 추가
/usr/lib
/usr/lib64
추가 후 lftp 실행 결과 정상 동작...

이거 하나 해결하려고 2시간 삽질.... 아놔...
저작자 표시 비영리
Posted by 마성민
회사에서 운영중인 서버중 MySQL을 사용하는 DB 서버만 대략 100여대 가량이다 보니(다 제각각이에요 ㅠ_ㅠ) 가끔씩 오류로 인해 서버가 다운되거나 MySQL 데몬이 죽었을때 테이블이 깨지는 경우가 발생 하곤 합니다. ㅠ _ㅠ

하나하나 찾아서 Repair 하기도 어렵기도 하고 귀찮기도 하고.. 그냥 간단하게 스크립트로 Check 해서 결과를 리턴하는 형식의 스크립트를 짰는데..

결과를 보는게 조금 엉성 하네요.. =ㅠ = ;; 꾸미는데에는 재주가 없어서;; ㅎㅎ

필요하신 분들은 가져가셔서 사용하시고.. 퍼가실때에는 출처만 밝혀주세요 +_+ ㅎㅎ

더보기



이게.. VI에서 탭으로 구분해 놓은걸 그대로 가져왔더니 이렇게 올라가네요;; =ㅠ=;;
저작자 표시 비영리
Posted by 마성민

잘 동작하던 메일 스팸서버의 DB가 갑자기 데이터가 쌓이지 않기 시작 했다..
원인은 알 수 없었고.. 이리 저리 뒤져보았더니 MySQL의 경우 Linux 시스템에 따라 MyISAM 엔진이 저장할 수 있는 최대 데테이블 데이터 사이즈가 지정되어 있다고 한다.

Operating System File-size Limit
Win32 w/ FAT/FAT32 2GB/4GB
Win32 w/ NTFS 2TB (possibly larger)
Linux 2.2-Intel 32-bit 2GB (LFS: 4GB)
Linux 2.4+ (using ext3 file system) 4TB
Solaris 9/10 16TB
MacOS X w/ HFS+ 2TB
NetWare w/NSS file system 8TB

- 관련 문서 : http://dev.mysql.com/doc/refman/5.0/en/full-table.html

우선 서버에서 해당 테이블의 상태를 확인하기 위해 아래와 같이 명령어를 실행..
mysql> show table status like 'mail_content' \G
*************************** 1. row ***************************
           Name: mail_content
         Engine: MyISAM
        Version: 9
     Row_format: Dynamic
           Rows: 548249
 Avg_row_length: 7833
    Data_length: 4294967280
Max_data_length: 4294967295
   Index_length: 40935424
      Data_free: 0
 Auto_increment: NULL
    Create_time: 2008-04-24 11:31:01
    Update_time: 2010-07-27 11:53:13
     Check_time: 2010-05-12 09:50:03
      Collation: utf8_general_ci
       Checksum: NULL
 Create_options:
        Comment:
1 row in set (0.00 sec)

상태를 보니 이미 MAX_data_Length값인 4G까지 모두 사용중이네요..
20G 까지 테이블 사이즈를 늘리기 위해 다음 명령어를 실행...하였습니다.

 alter table mail_content MAX_ROWS=1000000 AVG_ROW_LENGTH=21474;

위의 내용을 보면 최대 행(Row)는 1,000,000개 까지 저장 가능하도록 하였고, 각 행의 평균 길이는 21474 Byte로 지정 하였습니다.
이 명령어는 다음 내용을 참조하여 생성 하였습니다.

MySQL의 MyISAM 스토리지 엔진의 데이터 테이블의 전체 크기는 [SHOW variables]명령을 통해 확인 할 수 있는 myisam_data_pointer_size 라는 값에 의하여 결정 된다고 합니다.

이 myisam_data_pointer_size는 최소 2부터 최대 7까지 값을 가지고 있으며, 이 값을 참조하여 다음 공식에 의해 테이블 사이즈의 최대 크기를 지정 할 수 있습니다.

[ 2 ^ ( myisam_data_pointer_size * 8 ) - 1 byte ]

위의 공식을 따라 기본값인 4를 대입하면 4Gbyte까지 생성 할 수 있음을 알 수 있습니다.
문제는 이 값을 임의로 수정하는 것이 아닌 Alter Table 또는 Create Table 명령을 사용할 때 MAX_ROWS 와 AVG_ROW_LENGTH 값을 변경 하면 myisam_data_pointer_size 값이 자동으로 변경 된다는 것 입니다.

그럼 제가 원하는 20G 사이즈의 테이블을 생성하기 위해서는 어떻게 해야 할까요?
다음의 3가지 방식의 명령 모두 20G 사이즈의 테이블로 수정하는 명령입니다.

명령 1 : ALTER TABLE mail_content MAX_ROWS=1 AVG_ROW_LENGTH=21474836480
명령 2 : ALTER TABLE mail_content MAX_ROWS=20971520 AVG_ROW_LENGTH=1024
명령 3 : ALTER TABLE mail_content MAX_ROWS=1000000 AVG_ROW_LENGTH=21474

위의 3가지 방식의 명령 모두 20G 사이즈의 테이블을 생성하는 명령어 입니다.
자신이 원하는 방식을 이용하면 되겠지만, 테이블의 내용에 따라서 이 명령어를 다르게 적용하여 주는 것이 더 좋습니다.

예를 들어 테이블의 데이터 타입이 BLOB 또는 TEXT 일 경우에는 MAX_ROWS를 일정 수치이하로 줄이고 AVG_ROW_LENGTH 값을 늘려주는 것이 좋습니다.
다른 예로 테이블의 데이터 타입이 Integer 또는 Boolean과 같은 데이터 사이즈가 작은 경우라면 MAX_ROWS값을 늘리고 AVG_ROW_LENGTH값을 줄이는 것이 더 효과적입니다.


결론을 내리자면, 테이블의 사이즈를 변경하는 것은 ALTER TABLE 또는 CREATE TABLE 명령을 이용하여 MAX_ROWS값과 AVG_ROW_LENGTH값을 주게되면 myisam_data_pointer_size 값이 변경되면서 자연적으로 적용되게 됩니다.

만약 ALTER TABLE을 사용하는 경우라면 테이블 사이즈에 따라 또는 테이블 내 행의 개수에 따라 작업 시간을 조율 하시기 바랍니다.

저같은 경우 4G의 데이터 파일을 ALTER TABLE로 수정하는데 약 12분 가량 소요되었고, 그 시간동안에는 해당 테이블에 Lock이 걸리게 되므로, 약간의 장애 유사한 현상이 발생했었습니다. ^^*

참고 하세요~ =ㅁ=

Posted by 마성민

OMSA란?
Dell 에서 제공하는 서버 관리용 오픈 매니저 프로그램 입니다. Dell 서버의 경우 OMSA 를 설치하여 현재 하드웨어 자원의 상태를 모니터링 할 수 있으며, SNMP와 연계하여 상세 정보들을 가져올 수가 있습니다. 특히, Perc 카드를 이용하여 Raid구성을 하였다면, 구성한 Raid에 문제는 없는지를 한눈에 쉽게 알아 볼 수 있기 때문에 서버 관리자에게는 특히나 유용 합니다.

기존의 OMSA는 소스 다운로드 후 컴파일 및 기타 여러 프로그램을 추가적으로 설치해야 하며, Centos의 경우 RHEL에 해당하는 Release 네임이 아닐경우 정상적인 설치가 되지 않는 경우가 발생하여, 설치가 굉장히 까다롭고 힘들었었습니다.

하지만, 여기서 소개할 방법은 Yum을 이용해 Dell의 repository 내용을 다운로드 받아 설치하는 방식으로 위의 참조 URL을 통해 내용을 확인 할 수 있습니다.

- Quick Install -

1. Root 계정 로그인
2. 명령어 실행 : $wget -q -O - http://linux.dell.com/repo/hardware/latest/bootstrap.cgi | bash
3. 명령어 실행 : $yum install srvadmin-all
4. 접속 계정 설정 : vi /etc/osarolemap
5. Root 로그인 할 경우 접속 계정에 대한 수정 없이 다음 명령어 실행
$/opt/dell/srvadmin/omil/supportscripts/srvadmin-services.sh start
6. IPTABLE 사용시 IPTABLE에 1311 포트 오픈
7. https://IP_ADDRESS:1311/ 접속

- Truble Shooting -

Q : yum install svradmin-all을 했는데 아무런 패키지도 다운받지 않고, 실행도 되지 않습니다.
A : Yum의 Cache로 인해 막혀 있어서 그렇습니다. 다음 명령어를 실행하면 정상적으로 처리가 가능 합니다.
    $yum clean all
    $vi /etc/yum.conf
    파일의 내용중 plugins=1이 있는지 확인, 없으면, 추가
    $yum install svradmin-all

Q : Centos 3.x버전이라 yum 버전이 낮습니다. 어떻게 해야 하나요?
A : Yum 버전을 2.4.x버전이상 사용하시면 가능 합니다. yum 데몬을 업데이트 하시거나, Rpm으로 받으셔서 재설치 하세요.

Q : Centos가 아닌 SLES, RHEL3 또는 4입니다 어떻게 해야 하나요?
A : 참조 URL을 보시면, 각 OS별 설치법이 나와 있습니다. 참고하여 설치하시면 됩니다.

참조 URL : http://linux.dell.com/wiki/index.php/Repository/hardware

Posted by 마성민

고객 서버에 mod_jk를 설치...

내 서버와 테스트 서버에서는 아무런 문제 없이 설치가 되길래..
그냥 스크립트 만들어서 당직자한테 실행하라고 했는데..

새벽2시.. 에러난다는 전화..
컴파일을 아무리 해도 문제 발생... 확인해 보니 mod_jk.so 파일 생성이 안됨..
make시 에러는

Warning! dlname not found in /usr/local/apache/modules/mod_jk.la

라고 출력..
make install해도.. mod_jk.so파일이 없으므로, 당연 인스톨 안됨..

이럴때는 2가지 방법으로 해결.
1. tomcat.apache.org에 들어가서 jk_connector를 바이너리버전으로 다운로드
 > 이미 so파일로 되어 있으므로, 각 플랫폼에 맞는놈으로 다운받은뒤, mod_jk.so로 파일명 변경 후 apache의 module 폴더에 그대로 옮겨줌..

2. 난 죽어도 컴파일 해서 해야 겠다.
 > libtool의 버전 확인 필요.
 $ /usr/local/apache/build/libtool --version  ( Apache 경로는 각자 경로대로 )
 위와 같이 명령어 실행해서 출력되는 버전이 1.5.22 이면 정상 컴파일 가능하지만, 만약 1.5.20 이면..
 컴파일 안되고, 위와 같은 에러 출력함...
 $ rpm -qa | grep libtool 실행
 설치된 패키지가 1.5.22면 /usr/bin/libtool 의 버전이 1.5.22 이므로, /usr/local/apache/build/libtool을 지우고 심볼릭 링크 연결.
 $ rm -f /usr/local/apache/build/libtool
 $ ln -s /usr/bin/libtool /usr/local/apache/build/libtool
 이후 다시 make 실행하면 정상적으로 컴파일 가능.

설치는 다 되었는데.. 문제는 mod_jk.so를 연동했음에도 불구하고 소스가 출력되는 문제 발생...
아놔.. 사람 갖고 장난치나.. ;; -_-..;
결국은 내 실수로 삽질을 한 꼴이 되어버린...

문제 해결을 위해 다음과 같이 접근.

phpinfo();로 apache Handler 및 Module Load 상태 확인.
mod_jk.so가 보인다면, 모듈은 로드 된 것이므로, 설정 내용 확인.
설정 내용중 worker를 woker라고 오타 내진 않았는지.. 사소한 오타로 인해 안될 수 있으므로, 재 확인 필요.
properties 파일과 mod_jk.conf 파일을 따로 만들어서 Include 함..

== mod_jk.conf ==
LoadModule jk_module          modules/mod_jk.so
JkWorkersFile conf/workers.properties
JkLogFile logs/mod_jk.log
JkLogLevel info
JkLogStampFormat "[%a %b %d %H:%M:%S %Y] "
JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories
JkRequestLogFormat "%w %V %T"
JkMount /jsp-examples/*.jsp default
JkMount /servlets-examples/* default
JkMount /*.jsp default

Alias /jsp-examples "/usr/local/tomcat/webapps/examples/jsp"
<Directory "/usr/local/tomcat/webapps/examples/jsp">
        Options Indexes +FollowSymLinks
        AllowOverride None
        Allow From all
</Directory>

Alias /servlets-examples "/usr/local/tomcat/webapps/examples/servlets"
<Directory "/usr/local/tomcat/webapps/examples/servlets">
        Options Indexes +FollowSymLinks
        AllowOverride None
        Allow from all
</Directory>

== worker.properties ==
workers.tomcat_home=/usr/local/tomcat
workers.java_home=/usr/local/java

worker.list=ajp13
worker.ajp13.port=8009
worker.ajp13.host=localhost
worker.ajp13.type=ajp13

파일 생성이 완료되면, httpd.conf를 열어 include함..
> Include conf/mod_jk.conf

VirtualHost 설정을 한 경우에는 해당 VirtualHost 안에 JkMount 설정.
Ex)
<VirtualHost *:80>
DocumentRoot /usr/local/tomcat/webapps/ROOT/
ServerName test.lovetonight.net
JkMount /*.jsp ajp13
JkMount /webapps/*.jsp ajp13
JkMount /ROOT/* ajp13
</VirtualHost>

위와 같이 했는데도 안된다면....
역시 방법은 구글링뿐..

5시간 삽질 종료.. 아흐..

'Linux > Apache' 카테고리의 다른 글

mod_jk 컴파일 에러 처리... -_-  (0) 2009/04/11
apache - Suexec 와 Cgi 파일간의 관  (0) 2006/11/13
[Kisa] Mod_Security Manual  (0) 2006/10/09
Posted by 마성민

mount시 nfs 화일 시스템 타입에 대한 옵션

텍스트 옵션을 쓰지 않고 nfs 화일 시스템은 struct nfs_mount_data 자료형의 바이너리 옵션을 필요로 한다. mount 프로그램은 `tag=value'라는 형식으로 처리하고 위에서 말한 구조체에 값을 설정한다. rsize=n, wsize=n, timeo=n, retrans=n, acregmin=n, acregmax=n, acdirmin=n, acdirmax=n, actimeo=n, retry=n, port=n, mountport=n, mounthost=name, mountprog=n, mountvers=n, nfsprog=n, nfsvers=n, namlen=n. The option addr=n 을 쓸 수는 있으나 무시된다. 다음의 논리적 참거짓(Boolean) 옵션 앞에는 no 를 붙일 수 있다: bg, fg, soft, hard, intr, posix, cto, ac, tcp, udp. 세부 사항은 nfs(5) 을 보기 바란다.

특별히 유용한 옵션으로는 다음이 있다.

rsize=8192,wsize=8192
기본 버터 사이트 1024 보다는 더 빠른 접속 속도를 위해 필요하다.
soft
이 옵션을 주면 일정 시간 동안 반응하지 않는 nfs 서버에 대해서는 타임아웃이 걸리도록 하며 그렇지 않은 경우 계속 마운트하고 있는다. 시간 설정은 timeo=time 을 사용한다. 이 옵션은 때때로 여러분의 nfs 서버
가 반응하지 않거나 서버로부터 화일을 받는 도중 리부팅할 때 사용된다



출처 : KLDP Man 한글화 페이지 (http://man.kldp.org/wiki/ManPage/mount.8)
Posted by 마성민
서버 관리를 해주다보면.. 참 어처구니 없는 일들이 많이 일어난다.

오늘의 문제는 다음과 같은 에러가 뜨는것.....

/usr/bin/perl: relocation error: /usr/lib/perl5/vendor_perl/5.8.8/i386-linux-thread-multi/auto/DBD/mysql/mysql.so: symbol mysql_init, version libmysqlclient_15 not defined in file libmysqlclient.so.15 with link time reference

구글을 찾아보고 이것 저것 해봤는데..
고객 서버의 구성이 참 독특하기도 하고, 서비스가 죽으면 안된다는 이야기...
원인은 perl에서 MySQL커넥션을 위한 라이브러리를 찾을때 MySQL의 라이브러리를 찾지 못한다는 이야기 인데..

머 에러야 그렇다고 치자..

원인을 찾아 /usr/lib/mysql을 찾았는데..
엥?? 폴더가 없다.. -_-;;;;;;

어쩌라는거지;;;

ldd /usr/bin/mysqlbinlog를 해보니 libmysqlclient.so.15의 경로가 들어가 있어야 할 자리에.. 아무런 내용이 없다.

쩝.. 그냥 mysql을 재설치 하면 간단하게 해결이 되겠지만..
고객은 MySQL서버가 단 1초라도 죽으면 안된단다 ..

그래서 내린 특단의 야매 조치..

동일한 OS를 Virtual Box를 이용해 설치 한 뒤 동일한 버전의 MySQL을 설치.
그리고 /usr/lib에 있는 mysql 폴더를 통째로 압축.
문제의 서버로 압축파일 전송 후 압축 해제.

perl 에러가 발생한 파일을 다시 확인해 보니 정상 동작.

후...... /usr/lib/mysql을 왜 지웠을까.. '_' ?
Posted by 마성민

Updating RedHat/CentOS Kickstart with new drivers

At work, we have a kickstart setup we have been using for a couple years now, with probably 150 servers out in the field based on this install. Our distro of choice is CentOS, a RedHat clone, and we are at version 4.4. This is out of date now, but it still works great for our needs, as security fixes are regularly back-ported. It would also be a major pain to upgrade our existing installations, and/or support multiple OS versions.

On to the issue at hand: we recently received some new server models that we’ll be supporting, both which have hardware not supported in CentOS 4.4. One machine has a RealTek RTL-8110 ethernet chip, and the other as a 3Ware 9650SE Raid controller. As I later discovered, this presented two unique problems with the kickstart - without the proper storage controller driver, one server didn’t find any disk to install on, and without the proper network driver, the other server couldn’t even connect to our kickstart server at all.

So, as you might guess, there are two different solutions here. The more elegant is for the storage controller, we can create a driver disk with the proper drivers, and make it available on the network during the kickstart. The network driver is more difficult - we need to insert it into the initrd image we provide for PXE boot, and then somehow copy it over after installation (this is an updated driver, r8169.ko, that exists in CentOS 4.4 but doesn’t support our newer card).

Adding a RAID/Storage Card Driver to the Kickstart:
For the driver disk, things are especially easy, as 3Ware provides a driver-disk compatible download, although not yet in the correct format to share over the network.

The driver provided by 3ware (http://www.3ware.com/KB/article.aspx?id=14546 ) includes the following:

-rwxr-xr-x 1 stever stever 66B Oct 10 2007 modinfo*
-rwxr-xr-x 1 stever stever 249B Oct 10 2007 modules.alias*
-rw-r--r-- 1 stever stever 377K Oct 10 2007 modules.cgz
-rwxr-xr-x 1 stever stever 28B Oct 10 2007 modules.dep*
-rwxr-xr-x 1 stever stever 463B Oct 10 2007 modules.pcimap*
-rwxr-xr-x 1 stever stever 192B Oct 10 2007 pci.ids*
-rwxr-xr-x 1 stever stever 339B Oct 10 2007 pcitable*
-rwxr-xr-x 1 stever stever 37B Oct 10 2007 rhdd*

This is all you need on a driver disk, so all you need to do is create a disk image, and copy these files over:

#Create a blank, 20MB image
dd if=/dev/zero of=/root/driverdisk.img bs=1M count=2
#Format the image with ext2
mkfs -t ext2 -q /root/driverdisk.img
#mount it and copy the files over
mount -o loop /root/driverdisk.img /mnt/tmp
cp /root/3ware/* /mnt/tmp/
umount /mnt/tmp

Now, copy the image over to somewhere accesible on kickstart, and update your ks.cfg with the following:
driverdisk --source=nfs:servername:/vol/kickstart/CentOS-4.4-x86/drivers/driverdisk.img

On network kickstart, anaconda should grab the driver, load it, and proceed normally. This should work for any non-network-card driver you need.

Adding a Network Card Driver to the Kickstart:
This is considerably more arduous, but not too difficult with the magic commands. Much of the information here comes from my friend Steve, www.kehlet.cx.

There is no nicely package/built driver provided by RealTek, just some source code with instructions for compiling.

I downloaded the driver here:
http://wiki.centos.org/HardwareList/RealTekr1000
After untar’ing unzip’ing, I ran make with the default settings, and manually changed the kernel version to build a smp driver as well (assuming you’re building on a single-cpu system):

[root@lb4 ~]# cd r8169-6.006.00/
[root@lb4 ~]# make
[root@lb4 ~]# mv src/r8169.ko r8169.ko.2.6.9-42.EL
[root@lb4 ~]# make clean
(edit src/Makefile, change the line “KVER := $(shell uname -r)” to “KVER := 2.6.9-42.ELsmp”
[root@lb4 ~]# make
[root@lb4 ~]# mv src/r8169.ko r8169.ko.2.6.9-42.ELsmp

Now you should have two .ko module files compatible with the different kernels - we need to get these inserted into the initrd image. An initrd is basically a disk image that holds various drivers and programs needed to pre-boot your system. It is usually a gzipped disk image file, so its nothing too special. Basically, you need to unzip & mount the initrd image, gunzip/cpio the modules.cgz file in the initrd, make the required changes, and package everything back up.

Here’s those steps in gory detail:

mkdir /mnt/tmp
mkdir /mnt/initrd
mkdir /var/tmp/work
mkdir /var/tmp/work/bootnet
mkdir /var/tmp/work/drvnet
gunzip < /root/tftpboot/initrd.img > /var/tmp/work/bootnet/initrd.img.ungzipped
cd /var/tmp/work/bootnet/
mount -o loop initrd.img.ungzipped /mnt/tmp2
cd /mnt/tmp2/modules
gunzip < modules.cgz | (cd /var/tmp/work/bootnet && cpio -idv)
cd /var/tmp/work/bootnet/2.6.9-42.EL/i686
cp /root/r8169-6.006.00/r8169.ko.2.6.9-42.EL r8169.ko
cd /var/tmp/work/bootnet/2.6.9-42.ELsmp/i686
cp /root/r8169-6.006.00/r8169.ko.2.6.9-42.ELsmp r8169.ko
cd /var/tmp/work/bootnet/
find 2.6.9-42.EL | cpio -ov -H crc | gzip > /mnt/tmp2/modules/modules.cgz
#edit /mnt/initrd/modules/pcitable
#add this:
0×10ec 0×8167 “r8169″ “Realtek|RTL-8110 Gigabit Ethernet”
umount /mnt/initrd
gzip < initrd.img.ungzipped > initrd.r8169.img

I had to boot up DSL, run lspci & lspci -n, to get the ID to put in here - third column has 10ec:8167, which is what we need
https://lists.sdsc.edu/pipermail/npaci-rocks-discussion/2007-September/027142.html

So now you can replace your initrd.img with the one you just created. The kickstart should work fine now, but upon reboot, the system will not be able to find the right driver. After the kickstart, you need to copy over the .ko files to the appropriate directories - we added a line in our post-install script to do this for us, it simply copies the .ko file to the appropriate directory (/lib/modules/`uname -r`/kernel/drivers/net/)

Hopefully this is useful to someone, I couldn’t find a good, comprehensive guide on how to do this, I had to pull data from a bunch of different sources.


Source : http://www.ruizs.org/archives/49     thx~ : ) steve~

Posted by 마성민

Open Storage란?

Linux 2009/02/15 04:01
오픈스토리지가 무엇인가에 대해 사장님께서 내주신 질문..

아무리 뒤져봐도 오픈 스토리지가 무엇인가에 대한 정의는 없고... 단시 Sun에서 Open Solaris를 이용한 OpenStorage를 내놓았고, 이 시스템이 주목받고 있다는 내용만 가득..

NetAPPs와 Sun의 오픈스토리지 커뮤니티, 구글링등을 통해 결론지은 내용은 아래의 내용이었다..

오픈 스토리지는 개방형 아키텍쳐를 이용하여 저렴한 비용으로 네트워크 파일 시스템을 구성하고, 정교한 오픈 소스 스토리지 소프트웨어를 사용 할 수 있는 시스템을 이야기 합니다.

예전의 스토리지 시장은 각 벤더사들의 독점적 지배구조로 구성되어 왔으며, 이는 폐쇄적인 소트리지 구성에 따라, 자신들의 디스크, 메모리, CPU가 아니면 적용 할 수 없도록 하였었습니다.

이를 오픈 스토리지가 나오게 되면서, 각 벤더사에서는 오픈소스기반인 리눅스 또는 솔라리스의 기반하에 오픈 소스 스토리지 소프트웨어를 개발 및 지원하였고, 이를 이용해 OSN과 같은 형식의 스토리지 망을 구성 할 수 있게 되었습니다.

정리하자면, 각 벤더사에서 내놓는 컴포넌트와 관리 프로그램이 아닌 오픈 소스기반의 시스템위에 오픈 소스 기반의 소프트웨어를 올려 스토리지 시스템을 저렴한 비용으로 구축하는게 아닐까 합니다.

오픈형 소프트웨어로는 openfiler같은 소프트웨어가 있을 수 있으며, 오픈형 OS는 리눅스와 오픈 솔라리스가 있고, 현재는 Sun의 오픈 솔라리스를 이용한 오픈 스토리지가 주목을 받고 있습니다.


예를들어 설명하자면, Dell 의 이퀄로직 이라는 스토리지는 수천만원을 호가 하는 고급형 스토리지 이다.
이 스토리지는 자체적으로 리플리케이션, 자동화된 복구 기능, 여러가지 관리의 편의성을 중시한 매니지먼트 툴을 제공한다.

이 스토리지가 다른 저가 스토리지와 하드웨어적으로 약간의 차이는 있겠지만, 그 차이가 수천만원의 가격을 좌지우지 할 만큼의 값어치가 있지는 않다.

그렇다는건 결국 스토리지를 관리하는 소프트웨어의 지원여부에 따라 가격이 달라 질 수 있다는 것이다.

이를 오픈 소스 소프트웨어를 이용한 오픈 스토리지 구성을 한다면, 저렴한 비용으로, 고가의 스토리지 못지 않은 네트워크 저장소를 구성 할 수 있는 것 이다.

-------------------------------------------------------------------------

실제 정의된 내용과 내가 알고 있는 내용이 다를 수 있습니다.
정확한 정의에 대해 아시는 분께서는 알려주시면 감사하겠습니다. (^^) (__) (^^)
 
Posted by 마성민

CentOS / Red Hat Linux: Install and manage iSCSI Volume

Internet SCSI (iSCSI) is a network protocol s that allows you to use of the SCSI protocol over TCP/IP networks. It is good alternative to Fibre Channel-based SANs. You can easily manage, mount and format iSCSI Volume under Linux. It allows access to SAN storage over Ethernet.

Open-iSCSI Project

Open-iSCSI project is a high-performance, transport independent, multi-platform implementation of iSCSI. Open-iSCSI is partitioned into user and kernel parts.

Instructions are tested on:
[a] RHEL 5
[b] CentOS 5
[c] Fedora 7
[d] Debian / Ubuntu Linux

Install Required Package

iscsi-initiator-utils RPM package - The iscsi package provides the server daemon for the iSCSI protocol, as well as the utility programs used to manage it. iSCSI is a protocol for distributed disk access using SCSI commands sent over Internet Protocol networks. This package is available under Redhat Enterprise Linux / CentOS / Fedora Linux and can be installed using yum command:
# yum install iscsi-initiator-utils

A note about Debian / Ubuntu Linux

If you are using Debian / Ubuntu Linux install open-iscsi package, enter:
$ sudo apt-get install open-iscsi

iSCSI Configuration

There are three steps needed to set up a system to use iSCSI storage:

  1. iSCSI startup using the init script or manual startup. You need to edit and configure iSCSI via /etc/iscsi/iscsid.conf file
  2. Discover targets.
  3. Automate target logins for future system reboots.
  4. You also need to obtain iSCSI username, password and storage server IP address (target host)

Step # 1: Configure iSCSI

Open /etc/iscsi/iscsid.conf with vi text editor:
# vi /etc/iscsi/iscsid.conf
Setup username and password:
node.session.auth.username = My_ISCSI_USR_NAME
node.session.auth.password = MyPassword
discovery.sendtargets.auth.username = My_ISCSI_USR_NAME
discovery.sendtargets.auth.password = MyPassword

Where,

  • node.session.* is used to set a CHAP username and password for initiator authentication by the target(s).
  • discovery.sendtargets.* is used to set a discovery session CHAP username and password for the initiator authentication by the target(s)

You may also need to tweak and set other options. Refer to man page for more information. Now start the iscsi service:
# /etc/init.d/iscsi start

Step # 2: Discover targets

Now use iscsiadm command, which is a command-line tool allowing discovery and login to iSCSI targets, as well as access and management of the open-iscsi database. If your storage server IP address is 192.168.1.5, enter:
# iscsiadm -m discovery -t sendtargets -p 192.168.1.5
# /etc/init.d/iscsi restart

Now there should be a block device under /dev directory. To obtain new device name, type:
# fdisk -l
or
# tail -f /var/log/messages
Output:

Oct 10 12:42:20 ora9is2 kernel:   Vendor: EQLOGIC   Model: 100E-00           Rev: 3.2
Oct 10 12:42:20 ora9is2 kernel:   Type:   Direct-Access                      ANSI SCSI revision: 05
Oct 10 12:42:20 ora9is2 kernel: SCSI device sdd: 41963520 512-byte hdwr sectors (21485 MB)
Oct 10 12:42:20 ora9is2 kernel: sdd: Write Protect is off
Oct 10 12:42:20 ora9is2 kernel: SCSI device sdd: drive cache: write through
Oct 10 12:42:20 ora9is2 kernel: SCSI device sdd: 41963520 512-byte hdwr sectors (21485 MB)
Oct 10 12:42:20 ora9is2 kernel: sdd: Write Protect is off
Oct 10 12:42:20 ora9is2 kernel: SCSI device sdd: drive cache: write through
Oct 10 12:42:20 ora9is2 kernel:  sdd: unknown partition table
Oct 10 12:42:20 ora9is2 kernel: sd 3:0:0:0: Attached scsi disk sdd
Oct 10 12:42:20 ora9is2 kernel: sd 3:0:0:0: Attached scsi generic sg3 type 0
Oct 10 12:42:20 ora9is2 kernel: rtc: lost some interrupts at 2048Hz.
Oct 10 12:42:20 ora9is2 iscsid: connection0:0 is operational now

/dev/sdd is my new block device.

Step # 3: Format and Mount iSCSI Volume

You can now partition and create a filesystem on the target using usual fdisk and mkfs.ext3 commands:
# fdisk /dev/sdd
# mke2fs -j -m 0 -O dir_index /dev/sdd1

OR
# mkfs.ext3 /dev/sdd1

Tip: If your volume is large size like 1TB, run mkfs.ext3 in background using nohup:
# nohup mkfs.ext3 /dev/sdd1 &

Mount new partition:
# mkdir /mnt/iscsi
# mount /dev/sdd1 /mnt/iscsi

Step #4: Mount iSCSI drive automatically at boot time

First make sure iscsi service turned on at boot time:
# chkconfig iscsi on
Open /etc/fstab file and append config directive:
/dev/sdd1 /mnt/iscsi ext3 _netdev 0 0



Posted by 마성민
TAG iscsi

Adding a Linux device driver

On Linux systems, device drivers are typically distributed in one of three forms:

  • A patch against a specific kernel version

  • A loadable module

  • An installation script that applies appropriate patches

The most common of all these is the patch against a specific kernel version. These patches can in most cases be applied with the following procedure:2

# cd /usr/src/linux ; patch -p1 < patch_file

Diffs made against a different minor version of the kernel may fail, but the driver should still work. Here, we cover how to manually add a network "snarf" driver to the kernel. It's a very complicated and tedious process, especially when compared to other operating systems we've seen.

By convention, Linux kernel source resides in /usr/src/linux. Within the drivers subdirectory, you'll need to find the subdirectory that corresponds to the type of device you have. A directory listing of drivers looks like this:

% ls -F /usr/src/linux/drivers
Makefile	cdrom/	i2o/	nubus/	sbus/	telephony/
acorn/	char/	isdn/	parport/	scsi/	usb/
ap1000/	dio/	macintosh/	pci/	sgi/	video/
atm/	fc4/	misc/	pcmcia/	sound/	zorro/
block/	i2c/	net/	pnp/	tc/

The most common directories to which drivers are added are block, char, net, usb, sound, and scsi. These directories contain drivers for block devices (such as IDE disk drives), character devices (such as serial ports), network devices, USB devices, sound cards, and SCSI cards, respectively. Some of the other directories contain drivers for the buses themselves (e.g., pci, nubus, and zorro); it's unlikely that you will need to add drivers to these directories. Some directories contain platform-specific drivers, such as macintosh, acorn, and ap1000. Some directories contain specialty devices such as atm, isdn, and telephony.

Since our example device is a network-related device, we will add the driver to the directory drivers/net. We'll need to modify the following files:

  • drivers/net/Makefile, so that our driver will be compiled

  • drivers/net/Config.in, so that our device will appear in the config options

  • drivers/net/Space.c, so that the device will be probed on startup

After putting the .c and .h files for the driver in drivers/net, we'll add the driver to drivers/net/Makefile. The lines we'd add (near the end of the file) follow.

ifeq ($(CONFIG_SNARF),y)
	L_OBJS += snarf.o
else
	ifeq ($(CONFIG_SNARF),m)
		M_OBJS += snarf.o
	endif
endif 

This configuration adds the snarf driver so that it can be either configured as a module or built into the kernel.

After adding the device to the Makefile, we have to make sure we can configure the device when we configure the kernel. All network devices need to be listed in the file drivers/net/Config.in. To add the device so that it can be built either as a module or as part of the kernel (consistent with what we claimed in the Makefile), we add the following line:

tristate 'Snarf device support' CONFIG_SNARF 

The tristate keyword means you can build the device as a module. If the device cannot be built as a module, use the keyword bool instead of tristate. The next token is the string to display on the configuration screen. It can be any arbitrary text, but it should identify the device that is being configured. The final token is the configuration macro. This token needs to be the same as that tested for with the ifeq clause in the Makefile.

The last file we need to edit to add our device to the system is drivers/net/Space.c. Space.c contains references to the probe routines for the device driver, and it also controls the device probe order. Here, we'll have to edit the file in two different places. First we'll add a reference to the probe function, then we'll add the device to the list of devices to probe for.

At the top of the Space.c file are a bunch of references to other probe functions. We'll add the following line to that list:

extern int snarf_probe(struct device *); 

Next, to add the device to the actual probe list, we need to determine which list to add it to. A separate probe list is kept for each type of bus (PCI, EISA, SBus, MCA, ISA, parallel port, etc.). The snarf device is a PCI device, so we'll add it to the list called pci_probes. The line that says

struct devprobe pci_probes[] __initdata = { 

is followed by an ordered list of devices. The devices higher up in the list are probed first. Probe order does not usually matter for PCI devices, but some devices are sensitive. Just to be sure the snarf device is detected, we'll add it to the top of the list:

struct devprobe pci_probes[] __initdata = {
#ifdef CONFIG_SNARF
	snarf_probe, 0},
#endif 

The device has now been added to the Linux kernel. When we next configure the kernel, the device should appear as a configuration option under "network devices."

'Linux' 카테고리의 다른 글

Open Storage란?  (0) 2009/02/15
CentOS / Red Hat Linux: Install and manage iSCSI Volume  (0) 2009/01/15
Adding a Linux device driver  (0) 2009/01/08
VirtualPC 2007 + Ubuntu 7.0 설치시 화면이 깨지는 경우 및 마우스 인식  (0) 2008/04/24
Xen Virt-install Example  (0) 2008/04/15
Xen  (0) 2008/03/26
Posted by 마성민
얼마전 회사 DB서버의 Replication이 깨지는 바람에 복구하게 됐다.

실제 운영중인 서버를 다운 시키고 백업 받을수는 없었기 때문에 최단시간동안 Write Lock을 걸고 백업을 받은 후 Write Lock을 해제하고 리플리케이션을 설정하는것이 관건 이었다.

그래서 다음과 같은 작업을 진행..

/usr/local/mysql/bin/mysqladmin -uroot -p flush-logs
/usr/local/mysql/bin/mysqladmin -uroot -p -C "flush tables with read lock"
/usr/local/mysql/bin/mysqldump --single-transaction --all-databases --extended-insert=FALSE -c -uroot -p -R > all-databases.sql


또는

/usr/local/mysql/bin/mysqladmin -uroot -p flush-logs
/usr/local/mysql/bin/mysql -u root -p -h localhost
Passwd :
MySQL > flush tables with read lock;
MySQL > show master status\G
+------------------+----------+--------------+------------------+
| File                     | Position   | Binlog_Do_DB | Binlog_Ignore_DB |
+------------------+----------+--------------+------------------+
| mysql-bin.000011  |   1024026  |                      |                          |
+------------------+----------+--------------+------------------+
1 row in set (0.00 sec)
# 위의 MASTER STATUS 정보는 별도로 저장해 두자.

/usr/local/mysql/bin/mysqldump --single-transaction --all-databases --extended-insert=FALSE -c -uroot -p -R > all-databases.sql

이제 백업된 파일이 생성이 되었다.
그렇다면, 슬레이브 서버에 접속하여 백업된 파일을 업로드 하고 Slave 셋팅 설정을 확인한다.


server-id = 2

master-host = 마스터서버IP

master-user = <계정>

master-password = <비밀번호>

셋팅값에 이상이 없으면 백업한 파일을 Restore 한다.

/etc/init.d/mysql restart
/usr/local/mysql/bin/mysql -u root -p
/usr/local/mysql/bin/mysql -u root -p < all-databases.sql

복구 작업이 모두 완료 되면 다음 명령어를 통해 recplication을 실행한다.

mysql> stop slave;
mysql> reset slave;
mysql> CHANGE MASTER TO MASTER_LOG_FILE="mysql-bin.000011", MASTER_POS='1024026';
mysql> start slave;
mysql> show slave status\G
            Slave_IO_State: Waiting for master to send event
               Master_Host: 마스터서버IP
               Master_User: repl
               Master_Port: 3306
             Connect_Retry: 60
           Master_Log_File: mysql-bin.000011
       Read_Master_Log_Pos: 1024026
            Relay_Log_File: mysqld-relay-bin.000002
             Relay_Log_Pos: 402402
     Relay_Master_Log_File: mysql-bin.000011
          Slave_IO_Running: Yes
         Slave_SQL_Running: Yes
           Replicate_Do_DB:
       Replicate_Ignore_DB:
        Replicate_Do_Table:
    Replicate_Ignore_Table:
  Replicate_Wild_Do_Table:
Replicate_Wild_Ignore_Table:
                Last_Errno: 0
                Last_Error:
              Skip_Counter: 0
       Exec_Master_Log_Pos: 1024026
           Relay_Log_Space: 402402
           Until_Condition: None
            Until_Log_File:
             Until_Log_Pos: 0
        Master_SSL_Allowed: No
        Master_SSL_CA_File:
        Master_SSL_CA_Path:
           Master_SSL_Cert:
         Master_SSL_Cipher:
            Master_SSL_Key:
     Seconds_Behind_Master: 0
1 row in set (0.00 sec)


출력된 데이터 중 Slave_IO_State가 Waiting for master to send event와 같으면 정상적인 리플리케이션이 동작하는 것이다.

만약 DB데이터의 양이 너무 많아 mysqldump로 백업 및 복구에 시간이 많이 소요된다면, MySQL의 MASTER/SLAVE 서버간의 버전이 동일하다는 가정하에, DB_DATA폴더를 통째로 압축하여 전송한뒤 압축 해제를 통해 복사하는것도 좋은 방법일 수 있다.


Posted by 마성민

- Virtual PC에서 Ubuntu 7.0 설치 할때 화면이 깨지는 경우

1. Ubuntu 기본 화면에서 alt + ctrl + F2를 눌러 콘솔로 접속
2. sudo vi /etc/X11/xorg.conf 파일을 열어 DefaultDepth 24를 DefaultDepth 16으로 수정
3. Ctrl + Alt + F7을 눌렀다가 다시 Ctrl + Alt + BackSpace 키를 눌러 텍스트 모드로 전환한
   뒤 다시 한번 더 데스크탑 모드로 복귀 합니다.
4. 정상 화면으로 복귀



- Virtual PC에서 Ubuntu 7.0 설치 후 마우스가 인식되지  않을때

1. Ctrl + Alt + F2를 눌러 다시 콘솔모드로 변환
2. sudo vi /boot/grub/menu.lst 파일을 열어 Kernel /boot/vmlinuz-2.6.20-15-generic과
  같이 부트커널에 대한 설정 내용이 있는 것 중 가장 최상위에 있는 내용의 마지막 뒤에
  i8042.noloop 를 입력한 뒤 저장
3. sudo reboot를 입력하여 재부팅 하면 정상 인식.

Posted by 마성민

Xen Virt-install Example

Linux 2008/04/15 15:33
Example 40–1 Solaris PV Guest


virt-install -n solarisPV --paravirt -r 1024 \ 
  --nographics -f /export/solarisPV/root.img -s 16 \ 
  -l /ws/xvm-gate/public/isos/72-0910/solarisdvd.iso


Example 40–2 Solaris HVM Guest


virt-install -n solarisHVM --hvm -r 1024 --vnc \ 
  -f /export/solarisHVM/root.img -s 16 \ 
  -c /ws/xvm-gate/public/isos/72-0910/solarisdvd.iso

For this version of virt-install, only installs from ISOs and physical CDs are supported for HVM. Network installations are not supported in this version. If a physical CD is used, remember to unmount it after use.



Example 40–3 Windows HVM Guest


# virt-install -n winxp --hvm -r 1024 --vnc \ 
  -f /export/winxp/root.img -s 16 -c /windows/media.iso

For this version of virt-install, only installs from ISOs and physical CDs are supported for HVM. Network installations are not supported in this version. If a physical CD is used, remember to unmount it after use.



Example 40–4 Install Microsoft Windows Using a Local File as a Root Disk

A normal file is used to store the contents of the guest domain disk image, as opposed to using a ZFS volume, for example.


virt-install --name windows1 --ram 1024 \
--cdrom /en_winxp_pro_with_sp2.iso --file /guests/windows1-disk
--file-size 10 --vnc
 


Example 40–5 Install Solaris Using Network Install and JumpStart onto a ZFS Volume


zfs create -V 8G pool/solaris1-disk
virt-install --name solaris1 --ram 1024 --nographics \
--file /dev/zvol/dsk/pool/solaris1-disk \
--location nfs:install.domain.com:/export/solaris/nv75 \
--autocf nfs:install.domain.com:/export/jumpstart/solaris1

'Linux' 카테고리의 다른 글

Adding a Linux device driver  (0) 2009/01/08
VirtualPC 2007 + Ubuntu 7.0 설치시 화면이 깨지는 경우 및 마우스 인식  (0) 2008/04/24
Xen Virt-install Example  (0) 2008/04/15
Xen  (0) 2008/03/26
[Script] 데몬 상주 확인용 간단 스크립트  (0) 2008/02/11
OpenSource NMS 툴  (0) 2007/08/31
Posted by 마성민