[설치] 하나의 서버에서 mysql 데몬 두개 실행

간단하게 특별한 설명 없이 적습니다.

/usr/local/mysql 에 소스 컴파일 된 mysql 이 위치

/etc/rc.d/init.d/mysqld start 실행시 /etc/my.cf 를 참조하여 실행됨.

특별한 옵션 없이 실행 상태 모습

[root@arh01 /]# ps aux | grep mysqld

root     32362  0.0  0.0  4184 1084 pts/2    S    15:46   0:00 /bin/sh /usr/local/mysql/bin/mysqld_safe –datadir=/usr/local/mysql/data –pid-file=/usr/local/mysql/data/arh01.clunix.ms.pid

mysql    32389  0.0  0.7 124688 15528 pts/2  Sl   15:46   0:00 /usr/local/mysql/libexec/mysqld –basedir=/usr/local/mysql –datadir=/usr/local/mysql/data –user=mysql –pid-file=/usr/local/mysql/data/arh01.clunix.ms.pid –skip-locking –port=3306 –socket=/tmp/mysql.sock

밑에 옵션을 이용해서 두번째 데몬 실행

당연히 데이터 베이스는 복사해 놓고…

팁 데이터 베이스 데이터 디렉은 카피 하시게 되면 user mysql로 그 하위 디렉터리까지 해주어야 실행 됩니다.

# ./mysqld_safe –basedir=/usr/local/mysql –datadir /usr/data –port=3307 –socket=/tmp/mysql1.sock –pid-file=/tmp/mysqld.pid &

새로운 포트로 접속 옵션

mysql -P 3307 -u root -p password

[root@arh01 /]# ps aux | grep mysqld

root     32362  0.0  0.0  4184 1084 pts/2    S    15:46   0:00 /bin/sh /usr/local/mysql/bin/mysqld_safe –datadir=/usr/local/mysql/data –pid-file=/usr/local/mysql/data/arh01.clunix.ms.pid

mysql    32389  0.0  0.7 124688 15528 pts/2  Sl   15:46   0:00 /usr/local/mysql/libexec/mysqld –basedir=/usr/local/mysql –datadir=/usr/local/mysql/data –user=mysql –pid-file=/usr/local/mysql/data/arh01.clunix.ms.pid –skip-locking –port=3306 –socket=/tmp/mysql.sock

root     32459  0.0  0.0  4672 1084 pts/1    S    15:47   0:00 /bin/sh ./mysqld_safe –basedir=/usr/local/mysql1 –datadir /usr/local/mysql1/data –port=3307 –socket=/tmp/mysql1.sock –pid-file=/usr/local/mysql1/data/mysql_pid.pid

mysql    32497  0.0  0.7 124408 15096 pts/1  Sl   15:47   0:00 /usr/local/mysql/libexec/mysqld –basedir=/usr/local/mysql1 –datadir=/usr/local/mysql/data –user=mysql –pid-file=/usr/local/mysql1/data/mysql_pid.pid –skip-locking –port=3307 –socket=/tmp/mysql1.sock –datadir /usr/local/mysql1/data

# netstat -ln

Active Internet connections (only servers)

Proto Recv-Q Send-Q Local Address               Foreign Address             State      

tcp        0      0 0.0.0.0:513                 0.0.0.0:*                   LISTEN      

tcp        0      0 0.0.0.0:514                 0.0.0.0:*                   LISTEN      

tcp        0      0 0.0.0.0:3306                0.0.0.0:*                   LISTEN      

tcp        0      0 0.0.0.0:3307                0.0.0.0:*                   LISTEN      

tcp        0      0 192.168.123.101:7788        0.0.0.0:*                   LISTEN      

tcp        0      0 0.0.0.0:111                 0.0.0.0:*                   LISTEN      

tcp        0      0 :::80                       :::*                        LISTEN      

tcp        0      0 :::22                       :::*                        LISTEN      

udp        0      0 0.0.0.0:111                 0.0.0.0:*                              

Active UNIX domain sockets (only servers)

Proto RefCnt Flags       Type       State         I-Node Path

unix  2      [ ACC ]     STREAM     LISTENING     5647574 /tmp/mysql.sock

unix  2      [ ACC ]     STREAM     LISTENING     5647721 /tmp/mysql1.sock

간단 테스트 였습니다.

서진우

슈퍼컴퓨팅 전문 기업 클루닉스/ 상무(기술이사)/ 정보시스템감리사/ 시스존 블로그 운영자

You may also like...

1 Response

  1. 2024년 9월 24일

    … [Trackback]

    […] There you can find 50792 more Info to that Topic: nblog.syszone.co.kr/archives/2112 […]

페이스북/트위트/구글 계정으로 댓글 가능합니다.