yum grouplist
yum -y groupinstall "Desktop" "Desktop Platform" "X Windows System" "Fonts"
2015년 6월 15일 월요일
2015년 5월 29일 금요일
ubunt 14.04 에서 NTFS mount 하기
* read only 로 마운트 하기
Majority of current Linux distributions supports NTFS file system out of
the box. To be more specific, support for NTFS file system is more
feature of Linux kernel modules rather than Linux distributions. First
verify if we have NTFS modules installed on our system.
sudo ls /lib/modules/3.13.0-24-generic/kernel/fs/ | grep ntfs
fdisk -l | grep NTFS
mkdir /mnt/ntfs
mount -t ntfs /dev/sdb1 /mnt/ntfs
fdisk -l | grep NTFS
mkdir /mnt/ntfs
mount -t ntfs /dev/sdb1 /mnt/ntfs
2015년 5월 23일 토요일
2015년 5월 14일 목요일
2015년 4월 28일 화요일
PPAS(Postgres Plus Advanced Server) HA 구성 with Corosync, Pacemaker, DRBD - step 6
* Pacemaker 설정(방법 2)
* Configuring Stonith
* Disable Stonith (node 1)
crm configure property stonith-enabled=false
* checking the cluster configuration, we should get no errors:
crm_verify -L
* Cluster General Configuration
* Configuring quorum to 2 nodes. For more information, look at pacemaker configuration.
crm configure property no-quorum-policy=ignore
crm configure rsc_defaults resource-stickiness=100
crm configure show
* Configuring DBIP
crm configure primitive DBIP ocf:heartbeat:IPaddr2 params ip=192.168.21.160 cidr_netmask=24 op monitor interval=30s
* Configuring DRBD on Cluster
crm configure primitive drbd_postgres ocf:linbit:drbd params drbd_resource="postgres" op monitor interval="15s"
crm configure ms ms_drbd_postgres drbd_postgres meta master-max="1" master-node-max="1" clone-max="2" clone-node-max="1" notify="true"
crm configure primitive postgres_fs ocf:heartbeat:Filesystem params device="/dev/drbd0" directory="/var/lib/pgsql" fstype="ext4"
* Configuring PostgreSQL on Cluster
crm configure primitive postgresql ocf:heartbeat:pgsql op monitor depth="0" timeout="30" interval="30"
-> 이건 PostgreSQL 용이고 PPAS 용으로 아래와 같이 해야 될 것 같음
crm configure primitive postgresql ocf:heartbeat:pgsql params \
pgctl=/opt/PostgresPlus/9.4AS/bin/pg_ctl \
psql=/opt/PostgresPlus/9.4AS/bin/psql \
pgdata=/var/lib/pgsql/data pgdba=enterprisedb pgport=5444 pgdb=edb \
op monitor depth="0" timeout="30" interval="10" \
op start timeout=120 interval=0 \
op stop timeout=120 interval=0
(위 파라미터에서 ocf:heartbeat:pgsql 로 한다는 것은 실제 /usr/lib/ocf/resource.d/heartbeat/pgsql 의 설정값을 사용한다는 것이므로 실제 양쪽 노드에서 파일을 열어 값이 정상인지 확인한다)
아마 아래 6줄과 같이 변경해야 할 것이다.
OCF_RESKEY_pgctl_default=/opt/PostgresPlus/9.4AS/bin/pg_ctl
OCF_RESKEY_psql_default=/opt/PostgresPlus/9.4AS/bin//psql
OCF_RESKEY_pgdata_default=/var/lib/pgsql/data
OCF_RESKEY_pgdba_default=enterprisedb
OCF_RESKEY_pghost_default=""
OCF_RESKEY_pgport_default=5444
crm configure group postgres postgres_fs DBIP postgresql
crm configure coasdflocation postgres_on_drbd inf: postgres ms_drbd_postgres:Master
crm configure order postgres_after_drbd inf: ms_drbd_postgres:promote postgres:start
crm configure show
* Setting the Preferential Node
crm configure location master-prefer-node1 DBIP 50: cos1.local
* Cluster managment
* Acessing from network
echo "host all all 192.168.21.0/24 md5">> /var/lib/pgsql/data/pg_hba.conf
* restart postgres to reload configuration:
crm resource stop postgresql
crm resource start postgresql
* 문제가 있어 postgresql resource 지우고 아래 명령어로 다시 세팅
crm configure primitive postgresql ocf:heartbeat:pgsql params \
pgctl=/opt/PostgresPlus/9.4AS/bin/pg_ctl \
psql=/opt/PostgresPlus/9.4AS/bin/psql \
pgdata=/var/lib/ppas/data pgdba=enterprisedb pgport=5444 pgdb=edb \
op monitor depth="0" timeout="30" interval="10" \
op start timeout=120 interval=0 \
op stop timeout=120 interval=0
* # crm resource cleanup [resource 명]
(한쪽 노드에서 실행해도 모든 노드에 적용되지만 잘 안 될 경우 모든 노드에서 명령어 실행)
* cat /proc/drbd 해서 primary/unknown 으로 나오는 경우 아래와 같이 한다.
On primary node
drbdadm connect all
On secondary node
drbdadm -- --discard-my-data connect all
Should work
PPAS(Postgres Plus Advanced Server) HA 구성 with Corosync, Pacemaker, DRBD - step 5
* iptables 확인 (both)
vi /etc/sysconfig/iptables
-A INPUT -m state --state NEW -m udp -p udp --dport 5404 -j ACCEPT
-A INPUT -m state --state NEW -m udp -p udp --dport 5405 -j ACCEPT
mkdir /var/log/cluster (both)
service iptables restart (both)
/etc/init.d/corosync start (node1)
* check if the service is ok (node 1)
grep -e "Corosync Cluster Engine" -e "configuration file" /var/log/messages
* check if corosync started on the right interface (node 1)
grep TOTEM /var/log/messages
* check if pacemaker is up (node 1)
grep pcmk_startup /var/log/messages
* check if the corosync process is up (node 1)
ps aux | grep corosync
* if everything is ok on node1, then we can bring corosync up on node2:
/etc/init.d/corosync start
* check the status of the cluster. Running on any node, the following command:
crm_mon -1
* 1 nodes configured 2 expected votes 에러 발생
-> /etc/corosync/corosync.conf 를 다른 것으로 수정
# Please read the corosync.conf.5 manual page
compatibility: whitetank
totem {
version: 2
secauth: off
threads: 0
interface {
ringnumber: 0
bindnetaddr: 192.168.21.0
bindnetaddr: 192.168.21.0
mcastaddr: 226.94.1.1
mcastport: 4000
ttl: 1
}
}
logging {
fileline: off
to_stderr: no
to_logfile: yes
logfile: /var/log/cluster/corosync.log
to_syslog: yes
debug: off
timestamp: on
logger_subsys {
subsys: AMF
debug: off
}
}
amf {
mode: disabled
}
aisexec {
user: root
group: root
}
service {
# Load the Pacemaker Cluster Resource Manager
name: pacemaker
ver: 0
}
* Set Corosync to automatic initialization (both nodes)
chkconfig --level 35 corosync on
* Pacemaker 설정
* crmsh 설치 (both)
-> 아래 에러 발생
error: Failed dependencies:
pssh is needed by crmsh-2.1-1.6.x86_64
python-dateutil is needed by crmsh-2.1-1.6.x86_64
python-lxml is needed by crmsh-2.1-1.6.x86_64
redhat-rpm-config is needed by crmsh-2.1-1.6.x86_64
-> yum -y install pssh python-dateutil python-lxml redhat-rpm-config
하고 다시 설치 시도
* 클러스터 일반 설정(node1) (방법 1)
crm configure property stonith-enabled=false
crm configure property no-quorum-policy=ignore
crm configure rsc_defaults resource-stickiness=100
* 클러스터 리소스 설정 (node1)
crm configure primitive DBIP ocf:heartbeat:IPaddr2 params ip=192.168.21.144 cidr_netmask=24 op monitor interval=30s
crm_mon -1
로 등록 상태를 확인하면, 아래와 같이 등록된 리소스를 확인할 수 있다.
[root@cos1 yum.repos.d]# crm_mon -1
Last updated: Tue Apr 21 03:30:03 2015
Last change: Tue Apr 21 03:29:57 2015
Stack: classic openais (with plugin)
Current DC: cos2.local - partition with quorum
Version: 1.1.11-97629de
2 Nodes configured, 2 expected votes
1 Resources configured
Online: [ cos1.local cos2.local ]
DBIP (ocf::heartbeat:IPaddr2): Started cos1.local
* [DRBD on cluster] (node1)
이어서, DRBD 설정도 순서대로 진행한다.
crm configure primitive drbd_postgres ocf:linbit:drbd params drbd_resource="postgres" op monitor interval="15s"
crm configure ms ms_drbd_postgres drbd_postgres meta master-max="1" master-node-max="1" clone-max="2" clone-node-max="1" notify="true"
crm configure primitive postgres_fs ocf:heartbeat:Filesystem params device="/dev/drbd0" directory="/var/lib/ppas" fstype="ext4"
* [PostgreSQL on cluster] (node1)
PostgreSQL도 리소스로 등록해준다.
crm configure primitive postgresql ocf:heartbeat:pgsql op monitor depth="0" timeout="30" interval="30"
* [Resource Grouping]
PostgreSQL과 관련하여 등록한 리소스들을 그룹으로 묶어주고, 순서를 부여한다.
crm configure group postgres postgres_fs DBIP postgresql
crm configure colocation postgres_on_drbd inf: postgres ms_drbd_postgres:Master
crm configure order postgres_after_drbd inf: ms_drbd_postgres:promote postgres:start
crm configure location master-prefer-node1 DBIP 50: cos1.local
* crm 에 resource 삭제시 아래 링크 참고
https://www.suse.com/documentation/sle_ha/book_sleha/data/sec_ha_config_crm.html
PPAS(Postgres Plus Advanced Server) HA 구성 with Corosync, Pacemaker, DRBD - step 4
14. PPAS 환경 설정 (both)
vi /etc/profile
vi ~/.bashrc
아래 내용 추가
source /opt/PostgresPlus/9.4AS/pgplus_env.sh
* init db (node1)
su - enterprisedb
initdb /var/lib/ppas/data
or
initdb /var/lib/pgsql/data
exit
15. enable trusted authentication on the nodes and cluster IP's (node1)
(아래 IP 는 각자 알맞게 변경해야 함)
echo "host all all 192.168.21.148/32 trust" >> /var/lib/ppas/data/pg_hba.conf
echo "host all all 192.168.21.149/32 trust" >> /var/lib/ppas/data/pg_hba.conf
echo "host all all 192.168.21.150/32 trust" >> /var/lib/ppas/data/pg_hba.conf
or
echo "host all all 192.168.21.161/32 trust" >> /var/lib/pgsql/data/pg_hba.conf
echo "host all all 192.168.21.162/32 trust" >> /var/lib/pgsql/data/pg_hba.conf
echo "host all all 192.168.21.160/32 trust" >> /var/lib/pgsql/data/pg_hba.conf
* enable PPAS to listen on all interfaces (node1)
vi /var/lib/pgsql/data/postgresql.conf
아래와 같이 수정
listen_addresses = '*'
* start ppas (node1)
이미 실행 중이라면 다음 명령어로 중지
pkill edb (both)
pkill pgagent (both)
/etc/init.d/ppas-9.4 start (node1)
아래 에러 발생시
waiting for server to start....sh: /var/lib/ppas/data/pg_log/startup.log: No such file or directory
디렉토리 생성해줌 (both)
mkdir -p /var/lib/pgsql/data/pg_log/
chown -R enterprisedb:enterprisedb /var/lib/pgsql
다시 ppas 시작
/etc/init.d/ppas-9.4 start (node1)
* create an admin user to manage ppas (node1)
su - enterprisedb
createuser --superuser admpgsql --pwprompt
* create a database and populate it with pgbench (node1)
createdb pgbench
pgbench -i pgbench
* Pgbench populates the db with some info, the objetive is to test ppas (node1)
pgbench -i pgbench
* (node1)
psql -U admpgsql -d pgbench
select * from pgbench_tellers;
* all ppas config is done.
* Checking if PPAS will work on node2
* on node1, we need to stop ppas (node1)
/etc/init.d/ppas-9.4 stop
umount /dev/drbd0
drbdadm secondary postgres
* we need to promote node2 as Primary on DRBD resource:
drbdadm primary postgres
mount -t ext4 /dev/drbd0 /var/lib/pgsql/
/etc/init.d/ppas-9.4 start
* Let's check if we can access the pgbench db on node 2:
psql -U admpgsql -d pgbench
select * from pgbench_tellers;
pgbench=# select * from pgbench_tellers;
tid | bid | tbalance | filler
-----+-----+----------+--------
1 | 1 | 0 |
2 | 1 | 0 |
3 | 1 | 0 |
4 | 1 | 0 |
5 | 1 | 0 |
6 | 1 | 0 |
7 | 1 | 0 |
8 | 1 | 0 |
9 | 1 | 0 |
10 | 1 | 0 |
(10 rows)
Now, that everything is ok, we should stop all the services, to initiate the cluster config:
node 2:
/etc/init.d/ppas-9.4 stop
umount /dev/drbd0
drbdadm secondary postgres
/etc/init.d/drbd stop
node 1:
drbdadm primary postgres
/etc/init.d/drbd stop
* ensure that all the services are disabled at the initialization. (both)
chkconfig --level 35 drbd off
chkconfig --level 35 ppas-9.4 off
* Configuring Corosync
node 1:
cp /etc/corosync/corosync.conf/example /etc/corosync/corosync.conf
vi /etc/corosync/corosync.conf
compatibility: whitetank
totem {
version: 2
secauth: off
threads: 0
interface {
ringnumber: 0
bindnetaddr: 192.168.1.0
mcastaddr: 239.255.1.1
mcastport: 5405
ttl: 1
}
}
logging {
fileline: off
to_stderr: no
to_logfile: yes
logfile: /var/log/cluster/corosync.log
to_syslog: yes
debug: off
timestamp: on
logger_subsys {
subsys: AMF
debug: off
}
}
amf {
mode: disabled
}
aisexec {
user: root
group: root
}
service {
# Load the Pacemaker Cluster Resource Manager
name: pacemaker
ver: 0
}
* From node1, we'll transfer the corosync config files to node2:
scp /etc/corosync/corosync.conf node2:/etc/corosync/
피드 구독하기:
글 (Atom)