2017년 3월 28일 화요일

UNISON Waiting for changes from server

UNISON Waiting for changes from server



unison 을 실행하였는데 "Waiting for changes from server" 메시지 출력 이후 한참 기다려도 끝이 안나는데 그래도 기다리면 결과가 나옵니다.

이유는 두 서버에 파일이 많으면 파일 비교 데이터를 생성하는 과정에서  시간이 걸리기 때문입니다.

서버 사양에 따라 다르겠지만 7기가 조금 넘은 분량인데 10분 정도 걸렸습니다.

# unison
Contacting server...
Connected [//mydomain2.com//home -> //mydomain1.com//home]
Looking for changes
Warning: No archive files were found for these roots, whose canonical names are:
        /home
        //mydomain1.com//home
This can happen either
because this is the first time you have synchronized these roots,
or because you have upgraded Unison to a new version with a different
archive format.

Update detection may take a while on this run if the replicas are
large.

Unison will assume that the 'last synchronized state' of both replicas
was completely empty.  This means that any files that are different
will be reported as conflicts, and any files that exist only on one
replica will be judged as new and propagated to the other replica.
If the two replicas are identical, then no changes will be reported.

If you see this message repeatedly, it may be because one of your machines
is getting its address from DHCP, which is causing its host name to change
between synchronizations.  See the documentation for the UNISONLOCALHOSTNAME
environment variable for advice on how to correct this.

Donations to the Unison project are gratefully accepted:
http://www.cis.upenn.edu/~bcpierce/unison

  Waiting for changes from server
Reconciling changes
Nothing to do: replicas have been changed only in identical ways since last sync.

2017년 3월 27일 월요일

CentOS 7.x lsyncd Error: Temporary or permanent failure on startup

CentOS 7.x lsyncd Error: Temporary or permanent failure on startup



# systemctl start lsyncd
Mon Mar 27 15:45:27 2017 Error: Temporary or permanent failure on startup of "/home/". Terminating since "insist" is not set.


Main Server


# cat /etc/ssh/sshd_config | grep PermitRoot
PermitRootLogin no


# vi /etc/ssh/sshd_config

#PermitRootLogin no
PermitRootLogin yes


# systemctl restart sshd


Backup Server


# ssh-keygen
# ssh-copy-id root@mainserverip
# systemctl start lsyncd

2017년 3월 22일 수요일

CentOS 7.x mod_cband compile error

CentOS 7.x mod_cband compile error



# ./configure
checking for gcc... no
checking for cc... no
checking for cc... no
checking for cl... no
configure: error: no acceptable C compiler found in $PATH
See `config.log' for more details.

# yum install gcc

# ./configure
checking for gcc... gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ANSI C... none needed
checking whether make sets $(MAKE)... yes
checking for apr_palloc in -laprutil... no
checking for an ANSI C-conforming const... yes
checking for apxs... no
checking for apxs2... no
configure: error: apxs missing

# yum install httpd-devel


# make

apxs -Wc,-Wall -Wc,-DDST_CLASS=3 -c src/mod_cband.c
/usr/lib64/apr-1/build/libtool --silent --mode=compile gcc -std=gnu99 -prefer-pic -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic  -DLINUX -D_REENTRANT -D_GNU_SOURCE -pthread -I/usr/include/httpd  -I/usr/include/apr-1   -I/usr/include/apr-1  -Wall -DDST_CLASS=3  -c -o src/mod_cband.lo src/mod_cband.c && touch src/mod_cband.slo
src/mod_cband.c: In function 'mod_cband_create_traffic_size':
src/mod_cband.c:1054:15: warning: comparison with string literal results in unspecified behavior [-Waddress]
     if ((unit != "" && unit[0] == 'G') || (unit == "" && kb >= mult*mult)) {
               ^
src/mod_cband.c:1054:49: warning: comparison with string literal results in unspecified behavior [-Waddress]
     if ((unit != "" && unit[0] == 'G') || (unit == "" && kb >= mult*mult)) {
                                                 ^
src/mod_cband.c:1058:15: warning: comparison with string literal results in unspecified behavior [-Waddress]
     if ((unit != "" && unit[0] == 'M') || (unit == "" && kb >= mult)) {
               ^
src/mod_cband.c:1058:49: warning: comparison with string literal results in unspecified behavior [-Waddress]
     if ((unit != "" && unit[0] == 'M') || (unit == "" && kb >= mult)) {
                                                 ^
src/mod_cband.c: In function 'mod_cband_get_dst':
src/mod_cband.c:1333:47: error: 'conn_rec' has no member named 'remote_ip'
     p.add.sin.s_addr = inet_addr(r->connection->remote_ip);
                                               ^
src/mod_cband.c: In function 'mod_cband_get_remote_host':
src/mod_cband.c:1362:10: error: 'struct conn_rec' has no member named 'remote_i '
     if (c->remote_ip != NULL)
          ^
src/mod_cband.c:1363:20: error: 'struct conn_rec' has no member named 'remote_i '
  addr = inet_addr(c->remote_ip);
                    ^
src/mod_cband.c:1365:10: error: 'struct conn_rec' has no member named 'remote_addr'
  addr = c->remote_addr->sa.sin.sin_addr.s_addr;
          ^
src/mod_cband.c: In function 'mod_cband_update_speed':
src/mod_cband.c:1905:19: warning: variable 'time_last_request' set but not used [-Wunused-but-set-variable]
     unsigned long time_last_request;
                   ^
src/mod_cband.c: In function 'mod_cband_check_connections_speed':
src/mod_cband.c:2963:19: warning: variable 'time_now' set but not used [-Wunused-but-set-variable]
     unsigned long time_now;
                   ^
apxs:Error: Command failed with rc=65536
.
make: *** [src/.libs/mod_cband.so] Error 1


# sed -i 's/remote_ip/client_ip/g' ./src/mod_cband.c
# sed -i 's/c->remote_addr/c->client_addr/g' ./src/mod_cband.c
# make
# make install


CentOS 7.x How to open 53 port

CentOS 7.x How to open 53 port


[root@vps log]# firewall-cmd --permanent --zone=public --add-service=dns
success
[root@vps log]# firewall-cmd --reload
success
[root@vps log]# firewall-cmd --list-all
public (active)
  target: default
  icmp-block-inversion: no
  interfaces: eth0
  sources:
  services: dhcpv6-client dns ftp http https mysql ssh
  ports:
  protocols:
  masquerade: no
  forward-ports:
  sourceports:
  icmp-blocks: echo-request
  rich rules:

[root@vps log]# netstat -ant | grep :53
tcp        0      0 127.0.0.1:53            0.0.0.0:*               LISTEN


how to remove

# firewall-cmd --permanent --zone=public --remove-service=dns

2017년 3월 21일 화요일

MariaDB charset UTF8 설정

MariaDB charset UTF8 설정


CentOS 7.x 버전에 APM 을 설치했더니 MySQL 디폴트 문자셋이 latin1 으로 되어있네요.

/etc/my.cnf 를 수정해주면 됩니다.

[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
# Settings user and group are ignored when systemd is used.
# If you need to run mysqld under a different user or group,
# customize your systemd unit file for mariadb according to the
# instructions in http://fedoraproject.org/wiki/Systemd

init_connect='set names utf8'
character-set-server=utf8

위 두줄은 추가해주고

# systemctl restart mariadb

2017년 3월 20일 월요일

How to fix, Replication slave server Error Duplicate entry

How to fix, Replication slave server Error Duplicate entry


Error 'Duplicate entry for key 'PRIMARY'' on query.

MySQL Replication 슬래이브 서버에서

show slave status 로 상태 확인시 위와 같은 에러가 있으면 더 이상 DB 데이터 싱크는 되지 않습니다.

아무튼 이런 경우에는 my.cnf 에 아래 옵션을 넣어주면 됩니다.

[mysqld]
server-id=2
slave-skip-errors=1062

1062 에러가 primary key 데이터 중복시 나는 에러입니다.

auto_increment 가 되어 있는데도 불구 하고 에러가 나는게 조금 이상하긴 하네요.

2017년 3월 15일 수요일

LSYNCD Error Terminating since out of inotify watches

LSYNCD Error Terminating since out of inotify watches



lsyncd 로그 파일에 아래와 같은 에러가 있다면 동기화 하려는 파일의 수가 많을 때 발생합니다.


Wed Mar 15 14:05:54 2017 Normal: --- TERM signal, fading ---
Wed Mar 15 14:05:56 2017 Error: Terminating since out of inotify watches.
Consider increasing /proc/sys/fs/inotify/max_user_watches


동기화 시키려는 파일이 많은 때는 위와 같은 에러가 발생합니다.

이럴때는 max_user_watches 수를 증가시켜 주면 됩니다.

먼저 얼마로 되어 있는지 확인해 보고 수치를 증가시켜 줍시다.

# cat /proc/sys/fs/inotify/max_user_watches
8192

# echo 65536 > /proc/sys/fs/inotify/max_user_watches


이제 lsyncd 를 재시작 하면 됩니다.