이 글은 다음의 글을 번역한 것입니다. 전문 번역자가 아니기에 오류가 있음을 미리 밝힙니다. https://www.percona.com/blog/2016/09/14/mysql-default-configuration-changes-between-5-6-and-5-7/ 이 블로그에서, 우리는 MySQL 5.6 과 5.7 사이에 기본 설정값의 차이에 대해 논의할 것이다. MySQL 5.7 은 여러분이 기대했던 다양한 새로운 기능이 추가되었다. 하지만, 현재 변수들 또한 알게모르게 변화가 있었다. MySQL 5.7은 5.6으로부터 거의 40개의 기본값이 변경되었다. 어떤 바뀐값들은 여러분의 서버 성능에 아주 크게 영향을 줄 것이고 어떤것은 알지도 모르체 넘어갈 거다. 나는 각각의 변화가 무엇이고 어떤 의미인지를 살펴볼 것이다. sync_binlog 와 같은 값들은 여러분의 서버에 […]
Oracle 11gR2 설치
Oracle 11gR2 설치 Silent Installation 방식이며 OFA(Optimal Flexible Architecture) 를 따른다. 환경 CentOS 6.8 64bit Memory 4GB Swap 8GB (Swap must be enabled double the size of RAM) Storage Size 50GB 호스트네임 변경
|
1 2 3 4 5 |
]# vi /etc/sysconfig/network HOSTNAME=oraserv1.systemv.pe.kr ]# vi /etc/hosts 192.168.96.42 oraserv1.systemv.pe.kr oraserv1 ]# /etc/init.d/network restart |
Selinux 설정 변경
|
1 2 |
]# vi /etc/selinux/config SELINUX=disable |
Kernel 3.10 설치
|
1 2 3 4 5 |
]# rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org ]# rpm -Uvh http://www.elrepo.org/elrepo-release-6-6.el6.elrepo.noarch.rpm ]# sed -i "s/enabled=1/enabled=0/g" /etc/yum.repos.d/elrepo.repo ]# yum --enablerepo=elrepo-kernel install kernel-lt ]# sed -i "s/default=1/default=0/g" /boot/grub/grub.conf |
설치 완료하고 나서 reboot. 계정생성
|
1 2 3 4 5 |
groupadd -g 500 oinstall groupadd -g 501 dba groupadd -g 502 oper useradd -u 500 -g oinstall -G dba,oper oracle |
의존성 패키지 설치
|
1 2 3 4 |
]# yum install compat-libstdc++-33.x86_64 elfutils-libelf-devel.x86_64 elfutils-libelf-devel-static.x86_64 gcc.x86_64 gcc-c++.x86_64 glibc-devel.x86_64 ksh.x86_64 libaio-devel.i686 libaio-devel.x86_64 libgomp.x86_64 libstdc++-devel.x86_64 sysstat.x86_64 unzip unixODBC.i686 unixODBC-devel.i686 unixODBC.x86_64 unixODBC-devel.x86_64 ]# yum remove ksh ]# wget ftp://ftp.pbone.net/mirror/www.whiteboxlinux.org/whitebox/4/en/os/x86_64/WhiteBox/RPMS/pdksh-5.2.14-30.x86_64.rpm ]# yum localinstall pdksh-5.2.14-30.x86_64.rpm |
OFA 디렉토리 생성
|
1 2 3 |
mkdir -p /u01/app/oracle/product/11.2.0/db_1 mkdir -p /u01/app/oraInventory chown oracle:oinstall -R /u01 |
sysctl.conf
|
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 31 32 33 34 35 36 37 38 39 40 41 |
fs.aio-max-nr = 1048576 # It is recommended to have a minimum of 256 as value for every 4MB of RAM you have. # So for 8GB RAM = 2048 * 4MB = 2048 * 256 = 524288 fs.file-max = 6815744 # It sets the maximum number of shared memory segments that server can handle. # As Oracle recommends the value should be at least 4096, # it says that we cannot find more than 4096 number of shared memory segments at any instance on the server. # Note that SHMMNI value is in numbers. # # No change it should be 4096. It must be increased if you have more than at least one fourth (1024) Oracle Databases running on the server. Which we never recommend. kernel.shmmni = 4096 # It defines the total amount of shared memory PAGES that can be used system-wide. # It means that to the use all the physical memory this value should be less than or equal to total physical memory size. # For DBA's, it means that sum of all SGA sizes on the server should be less than or equal to SHMALL value. # Note that SHMALL value is a number of pages. # # If you want the maximum size of SGA on this server to be 5GB, then this parameter value should be 5*1024*1024*1024 = 5368709120 bytes. This, in turn, says that you should not have any database with more than 5GB of SGA. But you can have multiple databases with each 5GB of SGA or even less. This is the fact why Oracle recommends to have this value more than half of the memory to utilize it for SGA(s). # # By chance, if your SGA size is more than 5GB say it is 7GB then 2 shared memory areas will be allocated to SGA with one of 5GB and two of 2GB sizes, which doesn's perform well. kernel.shmmax = 2147483648 # It defines the total amount of shared memory PAGES that can be used system-wide. It means that to the use all the physical memory this value should be less than or equal to total physical memory size. For DBA's, it means that sum of all SGA sizes on the server should be less than or equal to SHMALL value. Note that SHMALL value is a number of pages. # By default the page size on Linux is 4KB. The total size of RAM is 8GB. Let us leave at least 1GB of RAM for Linux kernel to run, with which consider 7GB can be used for Oracle Databases. Now value of SHMALL can be: # # (7*1024*1024)KB/4KB = 1835008 kernel.shmall = 95325 kernel.sem = 250 32000 100 128 # This parameter defines the range of port numbers that system can use for programs which want to connect to the server without a specific port number. # # Now, it makes sense if you have come across somebody advising you not to use port numbers for listener beyond 9000. Also, just look back to documents on OEM installation, Oracle uses and advises all the default port numbers less than 9000. net.ipv4.ip_local_port_range = 9000 65500 # This parameter defines the default and maximum RECEIVE socket memory through TCP. net.core.rmem_default = 262144 net.core.rmem_max = 4194304 # This parameter defines the default and maximum SEND socket memory through TCP. net.core.wmem_default = 262144 net.core.wmem_max = 1048586 |
/etc/security/limits.conf
|
1 2 3 4 5 6 7 |
# http://www.tecmint.com/setting-up-prerequisites-for-oracle-12c-installation/ oracle soft nofile 1024 oracle hard nofile 65536 oracle soft nproc 2047 oracle hard nproc 16384 oracle soft stack 10240 oracle hard stack 32768 |
/etc/security/limits.d/90-nproc.conf
|
1 2 |
* - nproc 16384 root soft nproc unlimited |
/etc/pam.d/login
|
1 |
session required pam_limits.so |
/etc/oraInst.loc
|
1 2 3 4 5 6 |
]# vim /etc/oraInst.loc inventory_loc=/u01/app/oraInventory inst_group=oinstall ]# chown oracle:oinstall /etc/oraInst.loc ]# chmod 664 /etc/oraInst.loc |
oracle 계정으로 로그인 한후에 Oracle 11gR2 바이너리 설치 […]
Oracle 12c 설치
Oracle 12c 설치 Silent Installation 방식이며 OFA(Optimal Flexible Architecture) 를 따른다. 환경 CentOS 7 64bit Memory 8GB Swap 16GB (Swap must be enabled double the size of RAM) Storage Size 40GB 호스트네임 변경
|
1 2 3 4 |
hostnamectl set-hostname oraserv1 hostnamectl set-hostname oraserv1 --static hostnamectl set-hostname "Server1 of Oracle Database" --pretty hostnamectl set-hostname oraserv1 --transient |
계정생성
|
1 2 3 4 5 6 7 8 9 10 11 |
groupadd -g 500 oinstall groupadd -g 501 dba groupadd -g 502 oper groupadd -g 503 backupdba groupadd -g 504 dgdba groupadd -g 505 kmdba groupadd -g 506 asmdba groupadd -g 507 asmoper groupadd -g 508 asmadmin useradd -u 500 -g oinstall -G dba,oper,backupdba,dgdba,kmdba oracle |
의존성 패키지 설치
|
1 |
yum install compat-libcap1-1.10 compat-libstdc++-* libstdc++-devel-* sysstat-10.1.5* gcc-4.* gcc-c++-4.* ksh* glibc-devel-* libaio-* libaio-devel-* |
OFA 디렉토리 생성
|
1 2 3 |
mkdir -p /u01/app/oracle/product/12.1.0.2/db_1 mkdir -p /u01/app/oraInventory chown oracle:oinstall -R /u01 |
sysctl.conf
|
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 31 32 33 34 35 36 37 38 39 40 41 |
fs.aio-max-nr = 1048576 # It is recommended to have a minimum of 256 as value for every 4MB of RAM you have. # So for 8GB RAM = 2048 * 4MB = 2048 * 256 = 524288 fs.file-max = 6815744 # It sets the maximum number of shared memory segments that server can handle. # As Oracle recommends the value should be at least 4096, # it says that we cannot find more than 4096 number of shared memory segments at any instance on the server. # Note that SHMMNI value is in numbers. # # No change it should be 4096. It must be increased if you have more than at least one fourth (1024) Oracle Databases running on the server. Which we never recommend. kernel.shmmni = 4096 # It defines the total amount of shared memory PAGES that can be used system-wide. # It means that to the use all the physical memory this value should be less than or equal to total physical memory size. # For DBA's, it means that sum of all SGA sizes on the server should be less than or equal to SHMALL value. # Note that SHMALL value is a number of pages. # # If you want the maximum size of SGA on this server to be 5GB, then this parameter value should be 5*1024*1024*1024 = 5368709120 bytes. This, in turn, says that you should not have any database with more than 5GB of SGA. But you can have multiple databases with each 5GB of SGA or even less. This is the fact why Oracle recommends to have this value more than half of the memory to utilize it for SGA(s). # # By chance, if your SGA size is more than 5GB say it is 7GB then 2 shared memory areas will be allocated to SGA with one of 5GB and two of 2GB sizes, which doesn's perform well. kernel.shmmax = 4294967296 # It defines the total amount of shared memory PAGES that can be used system-wide. It means that to the use all the physical memory this value should be less than or equal to total physical memory size. For DBA's, it means that sum of all SGA sizes on the server should be less than or equal to SHMALL value. Note that SHMALL value is a number of pages. # By default the page size on Linux is 4KB. The total size of RAM is 8GB. Let us leave at least 1GB of RAM for Linux kernel to run, with which consider 7GB can be used for Oracle Databases. Now value of SHMALL can be: # # (7*1024*1024)KB/4KB = 1835008 kernel.shmall = 1835008 kernel.sem = 250 32000 100 128 # This parameter defines the range of port numbers that system can use for programs which want to connect to the server without a specific port number. # # Now, it makes sense if you have come across somebody advising you not to use port numbers for listener beyond 9000. Also, just look back to documents on OEM installation, Oracle uses and advises all the default port numbers less than 9000. net.ipv4.ip_local_port_range = 9000 65500 # This parameter defines the default and maximum RECEIVE socket memory through TCP. net.core.rmem_default = 262144 net.core.rmem_max = 4194304 # This parameter defines the default and maximum SEND socket memory through TCP. net.core.wmem_default = 262144 net.core.wmem_max = 1048586 |
/etc/security/limits.conf
|
1 2 3 4 5 6 7 |
# http://www.tecmint.com/setting-up-prerequisites-for-oracle-12c-installation/ oracle soft nofile 1024 oracle hard nofile 65536 oracle soft nproc 2047 oracle hard nproc 16384 oracle soft stack 10240 oracle hard stack 32768 |
/etc/security/limits.d/20-nproc.conf
|
1 2 |
* - nproc 16384 root soft nproc unlimited |
/etc/oraInst.loc
|
1 2 3 4 5 6 |
]# vim /etc/oraInst.loc inventory_loc=/u01/app/oraInventory inst_group=oinstall ]# chown oracle:oinstall /etc/oraInst.loc ]# chmod 664 /etc/oraInst.loc |
oracle 계정으로 로그인 한후에 Oracle 12c 바이너리 설치 파일을 다음과 같이 압축 해제.
|
1 2 3 4 5 |
]$ mkdir -p orainst/12.1.0.2 ]$ cp *.zip orainst/12.1.0.2/ ]$ cd orainst/12.1.0.2 ]$ unzip linuxamd64_12102_database_1of2.zip ]$ unzip linuxamd64_12102_database_2of2.zip |
Silent 설치를 위한 파일 작성 […]
Postgresql 9.x Replication – Streaming Log
Streaming log replication 은 Postgresql 9.0 부터 도입된 기능이다. 이 기능은 Primary 에서 Standby 서버로 직접 전송함으로서 replication delay 를 줄여준다. 따라서 pg_xlog 파일전송이 필요가 없다. 또 xlog 를 Streaming 으로 받기 위해서 Primary 서버에 REPLICATION 권한의 접속 계정이 필요하다. Replication 권한 사용자 생성. Primary 서버에서 REPLICATION 권한의 사용자를 다음과 같이 생성해준다.
|
1 |
CREATE ROLE repuser WITH REPLICATION PASSWORD '12345' LOGIN |
그리고 Standby 서버에서 Primary 접속을 위해서 pg_hba.conf 파일을 Standby 서버 접속을 허용해 줍니다.
|
1 2 3 |
# The standby server must connect with a user that has replication privileges. # TYPE DATABASE USER ADDRESS METHOD host replication repuser 192.168.96.26/32 md5 |
중요한 것은 DATABASE 에 반드시 ‘replication’ 이여야 한다. Streaming Replication 을 위한 postgresql.conf […]
M-HA MySQL 설정
MySQL 은 인기있는 오픈소스 데이터베이스 시스템이다. 언제나 데이터베이스 시스템이라면 항상 따라오는 것이 Master-Slave 리플리케이션 환경이고 거기에 덧붙여 자동 페일오버(Auto FailOver) 를 어떻게 할 것이라는 골머리 앓는 주제가 따라서 나온다. MySQL 의 경우에 자체 적인 FailOver 솔루션이 있다. Fabric 이 그것인데, 아직은 많이 쓰이지는 않는 모양이다. 대신에 AutoFailOver 를 지원하는 제3의 툴들이 존재하는데 M-HA 가 바로 이러한 솔루션이다. M-HA 는 일본인이 Perl 을 이용해서 작성한 솔루션이다. github 저장소에 소스코드는 공개되어 있으며 저장소이름은 mha4mysql-manager 이다. 구조 M-HA 는 Manager 와 Node 로 […]
MongoDB 3.x 인증 알고리즘 변경
MongoDB 3.x 부터는 인증 알고리즘이 MONGODB-CR 에서 SCRAM-SHA-1 으로 변경되었다. 그런데 특정 사용자에 대해서 MONGODB-CR 방식을 적용해야할 필요가 생기기도 한다. 그래서 사용자마다 알고리즘을 달리 적용할 수 있을까? 결론부터 말하면 MongoDB 3.x 는 이를 지원하지만 지원하는 것 같지 않은 상태다. 공식적인 지원을 하지만 이를 구현하기 위해서는 서버를 중단해야하고 인증을 해제해야한 다음에 사용자 알고리즘을 고치고 다시 인증을 걸고 서버를 재시작해야 한다. 또, Replica Set 상태에서 Primary 에서 MONGODB-CR 인증을 설정한다고 하더라도 Secondary 에서는 SCRAM-SHA-1 으로 싱크가 된다. 그래서 프로그램상에서 Replica Set 에서 […]
MongoDB Replica Set 구성하기
MongoDB 는 Replication 을 지원한다. 이는 서비스의 지속성과 안전성을 제공하는 데이터베이스 시스템의 설비다. MongoDB 는 단순하게 데이터 복제를 위한 것뿐만 아니라 Master 가 장애시에 이를 Slave 를 Master 로 자동승격시켜준다. 수 많은 Slave 중에 어떤 것을 Master 로 승격할지를 투표를 통해서 결정한다. MongoDB 는 투표에 참여하기만 하는 것으로 Arbiter 를 세팅할 수도 있다. 이글은 다음의 아키텍쳐를 기반으로 한다. Replica Set 설정 replication 설정을 위해서 서버 두대에 etc/mongod.conf 파일을 다음과 같이 설정을 해준다.
|
1 2 3 |
replication: oplogSizeMB: 5120 replSetName: "rs1" |
oplogSizeMB 는 Replication 을 위해사용되는 로그파일의 용량을 […]
MongoDB 설치 및 환경설정
이 글은 MongoDB 설치 및 환경설정에 관한 글이다. 환경설정은 슈퍼유저의 인증을 설정하는 것까지 한다. Download and Extract Mongodb 는 Binary 배포를 하고 있다. 홈페이지에 접속해서 설치할 컴퓨터의 운영체제에 맞는 압축 파일을 다운로드 하면 된다. Downlaod URL 도 제공하기 때문에 서버에서 wget, curl 을 이용해서 바로 다운로드도 할 수 있다. Binary 파일이기 때문에 압축해제 하기만하면 설치가 완료 된다. 압축을 해제하고 나면 다음과 같은 파일들이 나온다.
|
1 2 3 4 5 6 7 |
mongodb]$ ls -lh 합계 104K -rw-r--r-- 1 instance1 tomcat 34K 4월 28 05:32 GNU-AGPL-3.0 -rw-r--r-- 1 instance1 tomcat 17K 4월 28 05:32 MPL-2 -rw-r--r-- 1 instance1 tomcat 1.4K 4월 28 05:32 README -rw-r--r-- 1 instance1 tomcat 36K 4월 28 05:32 THIRD-PARTY-NOTICES drwxr-xr-x 2 instance1 tomcat 4.0K 6월 4 19:46 bin |
보면알겠지만 달랑 실행을 위한 디렉토리와 파일만 존재한다. 이제 하나하나 설정을 해보자. 디렉토리 생성 먼저, 디렉토리를 […]
PostgreSQL Replication – Log Shipping
PostgreSQL 리플리케이션은 장애를 대비해 가용성을 높이는 최소한의 방법입니다. 현재 버전의 PostgreSQL 다양한 리플리케이션을 지원하는데, 이 문서는 가장 오래되고 기초적인 리플리케이션인 Log Shipping Replication 에 대해서 다룹니다. 이 리플리케이션은 Warm Standby 이라고 합니다. 이에 대한 설명은 PostgreSQL 문서에 다음과 같이 잘 나와 있습니다. 운영 서버에서 만드는 트랜잭션 로그 조각을 정기적으로 대기 서버로 옮기고, 그것을 적용시켜, 운영 서버가 장애로 멈추게 되면, 대기 서버를 운영해서, 가용성을 향상할 수 있다. 이 기능을 warm standby, 또는 log shipping 기능이라고 한다. 이 복제 방식은 먼저, 운영 […]
pg_terminate_backend, pg_cancel_backend
PostgreSQL 에서 쿼리를 취소시키위한 함수로 pg_terminate_backend, pg_cancel_backend 를 제공 합니다. 공식문서에는 다음과 같이 나와 있습니다. – pg_cancel_backend(pidint) : Cancel a backend’s current query. You can execute this against another backend that has exactly the same role as the user calling the function. In all other cases, you must be a superuser. – pg_terminate_backend(pidint) : Terminate a backend. You can execute this against another backend that has exactly the same role as the user calling the function. In all other cases, […]