일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | |||||
3 | 4 | 5 | 6 | 7 | 8 | 9 |
10 | 11 | 12 | 13 | 14 | 15 | 16 |
17 | 18 | 19 | 20 | 21 | 22 | 23 |
24 | 25 | 26 | 27 | 28 | 29 | 30 |
- 점심
- 전철
- 동경 모터쇼
- 라면
- 명령어
- 米沢、팽이
- しまじろう
- 여름
- one tab buy
- 스테이크
- 시스템관리
- 영단어
- TOY
- Shimajirou
- 코라쿠엔
- 돈까스
- youtuber
- 자동차
- 신쥬쿠
- 원탭바이
- 일본
- fish
- Sekai Entertainment
- 돼지갈비
- 토익
- 시마지로
- 리눅스
- paypay
- 칸칸
- 사이타마
- Today
- Total
IT Japan
메인티넌스 작업 수순서 본문
#================================================================================
#================================================================================
#================================================================================
#=====메인티넌스의 작업항목(우선도가 높은순)
#=====・ap3의 교체
#=====・atgames07 슬레이브의 작성
#=====・db33의 파일 디스크립터
#===== (재기동필요없나?원인은? 상세한 작업내용은)
#=====・pgpool의 설정
#=====・toyap2의 교체
#================================================================================
#================================================================================
#================================================================================
#이것 자체는 지침을 만들어 나가는데 조사하거나 구축 작업을 갔을 때 메모
#########################
#####・ap3의 교체#####
#########################
#모든 마운트 해제
umount /var/atgames/mail1
umount /var/atgames/mail2
umount /var/atgames/webdl1
umount /var/atgames/webdl2
umount /var/atgames/gdwebdl
umount /var/atgames/webdl
umount /var/atgames/image2/avatar
#컨텐츠 주위의 동기화
nice -n19 rsync -ltr --bwlimit=100000 --progress /var/atgames interdev@172.16.5.8:/var/
####ip 주소 변경####
# (복원 할 수 있도록하고 호스트 이름을 변경하려면)
#(지금 현재의ap3)
#eth0의 작업
cp -p /etc/sysconfig/network-scripts/ifcfg-eth0 /etc/sysconfig/network-scripts/bk`date +%Y%m%d`.ifcfg-eth0
cat /etc/sysconfig/network-scripts/ifcfg-eth0
sed -e "s/IPADDR=172.16.5.3/IPADDR=172.16.5.8/g" /etc/sysconfig/network-scripts/ifcfg-eth0 > /etc/sysconfig/network-scripts/ifcfg-eth0.tmp
cat /etc/sysconfig/network-scripts/ifcfg-eth0.tmp
mv /etc/sysconfig/network-scripts/ifcfg-eth0.tmp /etc/sysconfig/network-scripts/ifcfg-eth0
#eth1의 작업
cp -p /etc/sysconfig/network-scripts/ifcfg-eth1 /etc/sysconfig/network-scripts/bk`date +%Y%m%d`.ifcfg-eth1
cat /etc/sysconfig/network-scripts/ifcfg-eth1
sed -e "s/IPADDR=172.22.5.3/IPADDR=172.22.5.8/g" /etc/sysconfig/network-scripts/ifcfg-eth1 > /etc/sysconfig/network-scripts/ifcfg-eth1.tmp
cat /etc/sysconfig/network-scripts/ifcfg-eth1.tmp
mv /etc/sysconfig/network-scripts/ifcfg-eth1.tmp /etc/sysconfig/network-scripts/ifcfg-eth1
#(새로운 ap3)
#eth0의 작업
cp -p /etc/sysconfig/network-scripts/ifcfg-eth0 /etc/sysconfig/network-scripts/bk`date +%Y%m%d`.ifcfg-eth0
cat /etc/sysconfig/network-scripts/ifcfg-eth0
sed -e "s/IPADDR=172.16.5.8/IPADDR=172.16.5.3/g" /etc/sysconfig/network-scripts/ifcfg-eth0 > /etc/sysconfig/network-scripts/ifcfg-eth0.tmp
cat /etc/sysconfig/network-scripts/ifcfg-eth0.tmp
mv /etc/sysconfig/network-scripts/ifcfg-eth0.tmp /etc/sysconfig/network-scripts/ifcfg-eth0
#eth1의 작업
cp -p /etc/sysconfig/network-scripts/ifcfg-eth1 /etc/sysconfig/network-scripts/bk`date +%Y%m%d`.ifcfg-eth1
cat /etc/sysconfig/network-scripts/ifcfg-eth1
sed -e "s/IPADDR=172.22.5.8/IPADDR=172.22.5.3/g" /etc/sysconfig/network-scripts/ifcfg-eth1 > /etc/sysconfig/network-scripts/ifcfg-eth1.tmp
cat /etc/sysconfig/network-scripts/ifcfg-eth1.tmp
mv /etc/sysconfig/network-scripts/ifcfg-eth1.tmp /etc/sysconfig/network-scripts/ifcfg-eth1
------
#eth0의 재기동
(ap3,ap8)
/sbin/ifdown eth0
두 대 동시에 떨어 뜨리면、、、
/sbin/ifup eth0
연결을 vpn에서 직접이 아니라 일단 ap1 라든지을 통해,,,
#eth1의 재기동
(ap3,ap8)
/sbin/ifdown eth1
두 대 동시에 떨어 뜨리면、、、、、
/sbin/ifup eth1
라우팅 오류
any net 172.20.0.0 netmask 255.255.0.0 gw 172.22.0.5 dev eth1
any net 172.21.0.0 netmask 255.255.0.0 gw 172.22.0.5 dev eth1
any net 172.22.0.0 netmask 255.255.0.0 gw 172.22.0.5 dev eth1
any net 172.23.0.0 netmask 255.255.0.0 gw 172.22.0.5 dev eth1
any net 172.24.0.0 netmask 255.255.0.0 gw 172.22.0.5 dev eth1
any net 192.168.68.0 netmask 255.255.255.0 gw 172.16.0.7 dev eth0
any net 192.168.35.160 netmask 255.255.255.240 gw 172.16.0.7 dev eth0
any net 172.17.0.0 netmask 255.255.0.0 gw 172.16.13.7 dev eth0
any net 172.18.0.0 netmask 255.255.0.0 gw 172.16.13.8 dev eth0
any net 172.19.0.0 netmask 255.255.0.0 gw 172.16.13.9 dev eth0
/etc/init.d/network restart
------
호스트 이름 변경
cp -p /etc/sysconfig/network /etc/sysconfig/network.`date +%Y%m%d`
#(현재 ap3)
cat /etc/sysconfig/network
sed -e "s/HOSTNAME=gp_ap3/HOSTNAME=gp_ap8/g" /etc/sysconfig/network > /etc/sysconfig/network.tmp
cat /etc/sysconfig/network.tmp
mv /etc/sysconfig/network.tmp /etc/sysconfig/network
hostname gp_ap8
#(새로운 ap3)
cat /etc/sysconfig/network
sed -e "s/HOSTNAME=gp_ap8/HOSTNAME=gp_ap3/g" /etc/sysconfig/network > /etc/sysconfig/network.tmp
cat /etc/sysconfig/network.tmp
mv /etc/sysconfig/network.tmp /etc/sysconfig/network
hostname gp_ap3
#~12/20 마운트 상황~
124.39.15.13:/var/atgames/mail
71G 37G 31G 55% /var/atgames/mail1
124.39.15.14:/var/atgames/mail
71G 34G 33G 51% /var/atgames/mail2
172.16.2.1:/var/atgames/image1
62G 46G 13G 78% /var/atgames/webdl1
172.16.2.2:/var/atgames/image1
62G 25G 34G 42% /var/atgames/webdl2
172.16.8.5:/var/atgames/gdwebdl
388G 311G 58G 85% /var/atgames/gdwebdl
172.16.11.30:/var/atgames/webdl
265G 161G 105G 61% /var/atgames/webdl
172.16.11.30:/var/atgames/image2/avatar
265G 161G 105G 61% /var/atgames/image2/avatar
#ap8을 재기동한직후에 마운트한다.
mount -a
df -h
#로 마운트 상황을 확인한다
#portmap가 가동하고있는지를 확인
ps auxw | grep portmap
#nfs주변의 프로세스가 가동하고있는지를 확인
ps auxw | grep nfs
・・・가동하고 있지않은 경우에는, 각 프로세스를 기동한다.
/etc/rc.d/init.d/portmap start
/etc/rc.d/init.d/nfs start
#・・・그래도 안되었던 경우 개별적으로 마운트
(sample)
mount -t nfs -o rw,intr,soft,rsize=32768,wsize=32768,nfsvers=3,mountvers=3 172.16.8.5:/var/atgames/gdimage2/avatar /var/atgames/gadgetimg2/avatar
mount -t nfs -o rw,intr,soft,rsize=32768,wsize=32768,nfsvers=3,mountvers=3 172.16.8.5:/var/atgames/gdwebdl /var/atgames/gdwebdl
#-----
mount -t nfs -o rw,intr,soft,noatime,rsize=32768,wsize=32768,nfsvers=3,mountvers=3 124.39.15.13:/var/atgames/mail /var/atgames/mail1
mount -t nfs -o rw,intr,soft,noatime,rsize=32768,wsize=32768,nfsvers=3,mountvers=3 124.39.15.14:/var/atgames/mail /var/atgames/mail2
mount -t nfs -o rw,intr,soft,noatime,rsize=32768,wsize=32768,nfsvers=3,mountvers=3 172.16.2.1:/var/atgames/image1 /var/atgames/webdl1
mount -t nfs -o rw,intr,soft,noatime,rsize=32768,wsize=32768,nfsvers=3,mountvers=3 172.16.2.2:/var/atgames/image1 /var/atgames/webdl2
mount -t nfs -o rw,intr,soft,noatime,rsize=32768,wsize=32768,nfsvers=3,mountvers=3 172.16.8.5:/var/atgames/gdwebdl /var/atgames/gdwebdl
mount -t nfs -o rw,intr,soft,noatime,rsize=32768,wsize=32768,nfsvers=3,mountvers=3 172.16.11.30:/var/atgames/webdl /var/atgames/webdl
mount -t nfs -o rw,intr,soft,noatime,rsize=32768,wsize=32768,nfsvers=3,mountvers=3 172.16.11.30:/var/atgames/image2/avatar /var/atgames/image2/avatar
#NFS 버전이 아니야라고 말해되면 그 근처의 매개 변수를 제거
15 * * * * interdev /var/atgames/make_static.sh 1> /dev/null
#15,35,55 * * * * interdev /var/atgames/make_static.sh 1> /dev/null
#30 * * * * root /var/atgames/make_static.sh 1> /dev/null
59 23 1 4 * interdev /var/atgames/chg_html.sh 1> /dev/null
#4,9,14,19,24,29,34,39,44,49,54,59 * * * * interdev /var/atgames/diary/OutsideBlogUptake.sh 1> /dev/null
#숍상위에 표시되는 랭킹정적페이지 생성용
5 * * * * interdev /var/atgames/shop_ranking_creator_html.sh 1> /dev/null
#판매물 이벤트 (최신정보)의 정적페이지 생성용
#0 1 * * * interdev /var/atgames/event_creator_html_for_it.sh 1> /dev/null
#안내의 정적페이지 생성용
#0 1 * * * interdev /var/atgames/info_creator_html_for_it.sh 1> /dev/null
#tomcat log gzip
#55 5 * * * interdev /var/atgames/sh/tomcatlog_gzip.sh >/dev/null 2>&1
#user affiliate batch (log file -> database)
10 6 * * * interdev /var/atgames/user_affiliate/batch/dump_user_affiliate_log.sh 1> /dev/null 2>&1
cp -p /etc/crontab /etc/crontab.`date +%Y%m%d`
vi /etc/crontab
----------
멀티 캐스트 캐스트
cat /proc/sys/net/ipv4/icmp_echo_ignore_broadcasts
echo 0 > /proc/sys/net/ipv4/icmp_echo_ignore_broadcasts
# Disable Broadcast Ping ←추가
net.ipv4.icmp_echo_ignore_broadcasts=1 ←추가
cp -p /etc/sysctl.conf /etc/sysctl.conf.`date +%Y%m%d`
vi /etc/sysctl.conf
net.ipv4.icmp_echo_ignore_broadcasts=0
ping 명령에서 tomcat의 복제 주소로 확인
-----
[root@gp_ap2 ~]# /sbin/iptables -t nat -L
Chain PREROUTING (policy ACCEPT)
target prot opt source destination
REDIRECT tcp -- anywhere 172.16.5.201 tcp dpt:webcache redir ports 8080
Chain POSTROUTING (policy ACCEPT)
target prot opt source destination
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
iptables -t nat -A PREROUTING -p tcp -m tcp -d 172.16.5.201 --dport 8080 -j REDIRECT --to-ports 8080
iptables -t nat -A PREROUTING -d 172.16.1.201 -p tcp -m tcp --dport 80 -j REDIRECT --to-ports 80
[root@gp_ap3 logs]# iptables -t nat -A PREROUTING -p tcp -m tcp -d 172.16.5.201 --dport 8080 -j REDIRECT --to-ports 8080
[root@gp_ap3 logs]# /sbin/iptables -t nat -L
Chain PREROUTING (policy ACCEPT)
target prot opt source destination
REDIRECT tcp -- anywhere 172.16.5.201 tcp dpt:webcache redir ports 8080
Chain POSTROUTING (policy ACCEPT)
target prot opt source destination
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
-----
###################################
#####・atgames07 슬레이브의 작성#####
###################################
cd /var/atgames
mkdir -p /home/interdev/obatemp
env PGOPTIONS="-c statement_timeout=0" /usr/local/postgresql-9.0.2/bin/psql -h localhost -p 5432 -U postgres -c "select pg_switch_xlog();" >>/home/interdev/obatemp/db_restore.log 2>&1
sleep 5;
env PGOPTIONS="-c statement_timeout=0" /usr/local/postgresql-9.0.2/bin/psql -h localhost -p 5432 -U postgres -c "select pg_start_backup('for replication');" >>/home/interdev/obatemp/db_restore.log 2>&1
sleep 5;
#cd /usr/local/postgresql
su
cd /mnt/xfs
date >>/home/interdev/obatemp/db_restore.log 2>&1
sleep 5;
time ionice -c2 -n7 nice -n19 tar czf /var/atgames/data_`date +%Y%m%d`.tar.gz data >>/home/interdev/obatemp/db_restore.log 2>&1
sleep 5;
env PGOPTIONS="-c statement_timeout=0" /usr/local/postgresql-9.0.2/bin/psql -h localhost -p 5432 -U postgres -c "select pg_stop_backup();" >>/home/interdev/obatemp/db_restore.log 2>&1
sleep 5;
date >>/home/interdev/obatemp/db_restore.log 2>&1
(데이터 전송)
슬레이브에 전송
time ionice -c2 -n7 nice -n19 rsync --bwlimit=61440 --progress /var/atgames/data_`date +%Y%m%d`.tar.gz interdev@172.19.1.38:/var/atgames/
-----
cat /proc/sys/vm/drop_caches
echo 1 > /proc/sys/vm/drop_caches
cat /proc/sys/vm/drop_caches
echo 0 > /proc/sys/vm/drop_caches
cat /proc/sys/vm/drop_caches
(슬레이브에 설정)
rm -rf /usr/local/postgresql/data/pg_xlog
mkdir -p /usr/local/postgresql/data/pg_xlog/archive_status/
rm /usr/local/postgresql/data/postmaster.pid
-rw------- 1 postgres postgres 16777216 12月 21 14:02 000000010000021E0000003A
-rw------- 1 postgres postgres 257 12月 21 15:45 000000010000021E0000003A.00000020.backup
tar czf db33wal.tar.gz 000000010000021[E-F]*
------
pg_standby가 필요
cd /usr/local/src/postgresql-9.0.2/contrib/pg_standby
make
make install
-----
다음과 같이 수정하여 WAL 로그 파일을 일단 캡처 적당한 곳에서 스트리밍 복제로 전환
#restore_command = '/bin/cp /var/atgames/db/pg_standby/archive41 %f %p 2>>./pg_log/standby.log' # e.g. 'cp /mnt/server/archivedir/%f %p'
↓
restore_command = '/usr/local/postgresql/bin/pg_standby -d -s 20 -r 2 /var/atgames/db/pg_standby/archive41 %f %p 2>>./pg_log/standby.log' # e.g. 'cp /mnt/server/archivedir/%f %p'
시작 WAL 파일 가져 오기가 완료되면 스트리밍 복제로 전환하여 다시 시작
----------
db19 백업 서버의 재구성
새 버전 설치
[새로운 아이템 DB (atgames07)를 구축]
cd /usr/local/src
wget http://wwwmaster.postgresql.org/redir/311/h/source/v9.0.2/postgresql-9.0.2.tar.gz
wget http://wwwmaster.postgresql.org/redir/311/h/source/v9.0.2/postgresql-9.0.2.tar.gz.md5
md5sum postgresql-9.0.2.tar.gz
cat postgresql-9.0.2.tar.gz.md5
tar xzf postgresql-9.0.2.tar.gz
cd postgresql-9.0.2
./configure --prefix=/usr/local/postgresql-9.0.2
make
su
make install
------
cd /usr/local/src/postgresql-9.0.2/contrib/pg_standby
make
make install
-------
/usr/sbin/groupadd -g 5432 postgres
/usr/sbin/useradd -g 5432 -u 5432 -c 'DBAdmin' -d /home/postgres -m -s /bin/bash postgres
chown -R postgres.postgres postgresql-9.0.2
(createdb)
data의 작성
#cp -p /etc/rc.d/init.d/gp_postgres /etc/rc.d/init.d/gp_postgres9
#vi /etc/rc.d/init.d/gp_postgres9
mkdir -p /var/log/pgsql9
chown postgres.postgres /var/log/pgsql9
##########################################################
#####・db33의 파일 디스크립터 #####
##### (다시 들어 가지 않는다? 원인은? 자세한 작업 내용은)#####
##########################################################
・・・원인이 불명。。
・・・대처가 안됨。。
########################
#####・pgpool의 설정#####
########################
(대상외:qzent, qzgame1, qzgame2, qzgame5)・・・퀴즈1이 닫히기 때문에
(대상:qzgame3, qzmana, qzweb1, qzweb2, qzreserve, gifap1, gifap2, gp_mngap1)
퀴즈2C서버 qzgame3
퀴즈・점・플래쉬 대전apache qzmana
퀴즈・점・플래쉬 대전・옥션apache qzweb1 qzweb2
플래쉬 대전 서버 qzreserve
연계{I/F gp_gifap1 gp_gifap2
관리툴 gp_mngap1
qzweb1・・・수정개수가 많다.。。
퀴즈2C서버 qzgame3
퀴즈・점・플래쉬 대전 apache qzmana
플래쉬 대전C서버 qzreserve
----------
(qzgame3)
pgpool.conf を /usr/local/pgpool2/etcqz 의 이하에 배치한다.
mkdir -p /var/run/pgpool/
vi /etc/rc.d/init.d/gp_pgpool
(quiz계만을 기동하도록 기재나 수정한다.)
/etc/rc.d/init.d/gp_pgpool start
/usr/local/postgresql9/bin/psql -h localhost -U interdev -p 6432 -l
접속확인
----------
(qzmana)
qzgame3과 동등
/usr/local/postgresql9/bin/psql -h localhost -U interdev -p 6432 -l
---------
(qzreserve)
qzgame3과 동등
/usr/local/postgresql9/bin/psql -h localhost -U interdev -p 6432 -l
----------
퀴즈・점・플래쉬 대전・옥션 apache qzweb1 qzweb2
연계I/F gp_gifap1 gp_gifap2
관리 툴 gp_mngap1
기존의 pgpool이 가동하고 있으므로 새로운 버젼으로 옮긴다.
'IT > PostgreSQL' 카테고리의 다른 글
액세스 권한의 부여 (0) | 2019.03.07 |
---|---|
PostgreSQL의 기본적인 명령어 (0) | 2019.03.07 |
Master,Slave의 전환 수순 (0) | 2016.05.30 |
백업 (0) | 2016.05.30 |
Archive Log의 보존 방법 (0) | 2016.05.30 |