2016년 5월 19일 목요일

[MySqL] my.cnf backup

#
# The MySQL database server configuration file.
#
# You can copy this to one of:
# - "/etc/mysql/my.cnf" to set global options,
# - "~/.my.cnf" to set user-specific options.
#
# One can use all long options that the program supports.
# Run program with --help to get a list of available options and with
# --print-defaults to see which it would actually understand and use.
#
# For explanations see
# http://dev.mysql.com/doc/mysql/en/server-system-variables.html

# This will be passed to all mysql clients
# It has been reported that passwords should be enclosed with ticks/quotes
# escpecially if they contain "#" chars...
# Remember to edit /etc/mysql/debian.cnf when changing the socket location.
[client]
port = 3306
socket = /var/run/mysqld/mysqld.sock
default-character-set = utf8

# Here is entries for some specific programs
# The following values assume you have at least 32M ram

# This was formally known as [safe_mysqld]. Both versions are currently parsed.
[mysqld_safe]
socket = /var/run/mysqld/mysqld.sock
nice = 0

[mysqld]
#
# * Basic Settings
#
user = mysql
pid-file = /var/run/mysqld/mysqld.pid
socket = /var/run/mysqld/mysqld.sock
port = 3306
basedir = /usr
datadir = /var/lib/mysql
tmpdir = /tmp
lc-messages-dir = /usr/share/mysql
skip-external-locking

init_connect = SET collation_connection = utf8_general_ci
init_connect = SET NAMES utf8
character-set-server = utf8
collation-server = utf8_general_ci
log-bin-trust-function-creators=1
log-error=/var/log/mysql/mysql-err.log
log-slow-queries=/var/log/mysql/mysql-slow.log


#
# Instead of skip-networking the default is now to listen only on
# localhost which is more compatible and is not less secure.
bind-address = 127.0.0.1

#
# * Fine Tuning
#
key_buffer = 128M
max_allowed_packet = 128M
thread_stack = 192K
thread_cache_size       = 8
# This replaces the startup script and checks MyISAM tables if needed
# the first time they are touched
myisam-recover         = BACKUP
max_connections        = 500
#table_cache            = 64
#thread_concurrency     = 10
#
# * Query Cache Configuration
#
query_cache_limit = 1M
query_cache_size        = 16M

#
# * Logging and Replication
#
# Both location gets rotated by the cronjob.
# Be aware that this log type is a performance killer.
# As of 5.1 you can enable the log at runtime!
#general_log_file        = /var/log/mysql/mysql.log
#general_log             = 1
#
# Error log - should be very few entries.
#
log_error = /var/log/mysql/error.log
#
# Here you can see queries with especially long duration
#slow_query_log_file = /var/log/mysql/mysql-slow.log
#slow_query_log      = 1
#long_query_time = 2
#log_queries_not_using_indexes
#
# The following can be used as easy to replay backup logs or for replication.
# note: if you are setting up a replication slave, see README.Debian about
#       other settings you may need to change.
#server-id = 1
#log_bin = /var/log/mysql/mysql-bin.log
expire_logs_days = 10
max_binlog_size         = 100M
#binlog_do_db = include_database_name
#binlog_ignore_db = include_database_name
#
# * InnoDB
#
# InnoDB is enabled by default with a 10MB datafile in /var/lib/mysql/.
# Read the manual for more InnoDB related options. There are many!
#
# * Security Features
#
# Read the manual, too, if you want chroot!
# chroot = /var/lib/mysql/
#
# For generating SSL certificates I recommend the OpenSSL GUI "tinyca".
#
# ssl-ca=/etc/mysql/cacert.pem
# ssl-cert=/etc/mysql/server-cert.pem
# ssl-key=/etc/mysql/server-key.pem



[mysqldump]
quick
quote-names
max_allowed_packet = 128M
default-character-set = utf8


[mysql]
default-character-set = utf8
#no-auto-rehash # faster start of mysql but no tab completition

[isamchk]
key_buffer = 16M

#
# * IMPORTANT: Additional settings that can override those from this file!
#   The files must end with '.cnf', otherwise they'll be ignored.
#
!includedir /etc/mysql/conf.d/

2016년 4월 28일 목요일

2016년 4월 15일 금요일

[LiNuX] vim 환경 설정



아래의 설정을 ~/.vimrc 파일에 적용 한다.

set nu
  : 라인 넘버

set smartindent
  : 좀더 지능적인 들여쓰기 사용

syntax on
  : 구분 강조 기능 사용

filetype on
  : 파일의 종류에 따라 구분 강종

set visualbell
  : 사용자 실수를 경고할때 비프임 대신 비주얼 벨로 경고

set ruler
  : 화면 우측하단에 (행,열) 번호 추가




set tabstop=4
  : 탭간격을 2칸으로 지정

set expandtp
  : 탭문자를 공백문자로 변환

set nobackup
  : 백업파일을 생성하지 않음

set autoindent
  : 자동 들여쓰기 사용

set incsearch
  : 키워드를 입력할때 검색하는 점진 검색 사용

colorscheme evening
  : vi색상테마변경

set background=dark
  : 어두운 배경색 상용

set hisearch
  : 검색어 강조 기능 사용. 데비안7 버젼에서 안되는 것 같음.

set ignorecase
  : 검색,편집 치환시에 대소문자 구분하지 않음


출처 : http://sehkmg.blogspot.kr/2012/01/vi-editor-c.html

2016년 4월 7일 목요일

[EtC] 톰켓 여러개 설치



- Tomcat 1호기(?) 설치 위치 : /usr/local/tomcat-7.0.64_1/
- Tomcat 2호기(?) 설치 위치 : /usr/local/tomcat-7.0.64_2/


Tomcat 1호기(?) 의 server.xml 파일 내용
<Server port="8005" shutdown="SHUTDOWN">
    ... 중략 ...
    <Connector port="8080"
                    protocol="HTTP/1.1"
                    connectionTimeout="20000"
                    redirectPort="8443"
                    disableUploadTimeout="true"
                    enableLookups="false"
                    URIEncoding="UTF-8" />
    ... 중략 ...
    <Connector port="8009" protocol="AJP/1.3" redirectPort="8443" />


Tomcat 2호기(?) 의 server.xml 파일 내용
<Server port="8006" shutdown="SHUTDOWN">
    ... 중략 ...
    <Connector port="8081"
                    protocol="HTTP/1.1"
                    connectionTimeout="20000"
                    redirectPort="8443"
                    disableUploadTimeout="true"
                    enableLookups="false"
                    URIEncoding="UTF-8" />
    ... 중략 ...
    <Connector port="8010" protocol="AJP/1.3" redirectPort="8443" />


Tomcat 1호기(?) 의 catalina.sh 파일 내용에 추가
export CATALINA_HOME=/usr/local/tomcat-7.0.64_1
export TOMCAT_HOME=/usr/local/tomcat-7.0.64_1
export CATALINA_BASE=/usr/local/tomcat-7.0.64_1
CATALINA_PID=/usr/local/tomcat-7.0.64_1/bin/tomcat.pid


Tomcat 2호기(?) 의 catalina.sh 파일 내용에 추가
export CATALINA_HOME=/usr/local/tomcat-7.0.64_2
export TOMCAT_HOME=/usr/local/tomcat-7.0.64_2
export CATALINA_BASE=/usr/local/tomcat-7.0.64_2
CATALINA_PID=/usr/local/tomcat-7.0.64_2/bin/tomcat.pid


2016년 4월 1일 금요일

[LiNuX] 한번 입력으로 비밀번호 변경

리눅스의 쉘스크팁트에서 비밀번호를 변경 하는 경우 아래와 같이 사용이 가능 하다.

root@localhost:~# echo '비밀번호' | passwd --stdin 계정

예)
root@localhost:~# echo '@@1234&&' | passwd --stdin freecatz



데비안 계열 리눅스의 passwd 명령에는 --stdin 옵션이 없다.

검색을 해보니 chpasswd 명령을 이용 하면 된다고 한다.


root@localhost:~# echo '계정:비밀번호' | chpasswd

예)
root@localhost:~# echo 'freecatz:@@1234&&' | chpasswd


자세한 내용은 아래의 참고 사이트를 확인 할 것.


참고 사이트 : http://snoopybox.co.kr/1713

2016년 3월 1일 화요일

[EtC] mac os x terminal color


bash_profile 에 아래의 내용을 추가 



freecatz-MacBook-Pro:~ freecatz$ vi ~/.bash_profile
export CLICOLOR=1
export LSCOLORS=GxFxCxDxBxegedabagaced


freecatz-MacBook-Pro:~ freecatz$ source ~/.bash_profile



참고 : http://osxdaily.com/2012/02/21/add-color-to-the-terminal-in-mac-os-x/

2016년 2월 26일 금요일

[EtC] 간만에 보는 좀비 프로세스

[root@localhost usr]# ps -ef | grep -i httpd
root      5681     1  0  2015 ?        00:02:31 /usr/bin/httpd
nobody   26720     1  0  2015 ?        00:00:00 /usr/local/apache/bin/httpd -DSSL
nobody   29354     1  0  2015 ?        00:00:00 /usr/local/apache/bin/httpd -DSSL
nobody   29363     1  0  2015 ?        00:00:00 /usr/local/apache/bin/httpd -DSSL
nobody   32225     1  0  2015 ?        00:00:00 /usr/local/apache/bin/httpd -DSSL
root      5198     1  0 Feb24 ?        00:00:00 /usr/local/apache2/bin/httpd -k start
nobody   22321  5198  0 06:54 ?        00:00:00 /usr/local/apache2/bin/httpd -k start
nobody   22322  5198  0 06:54 ?        00:00:00 /usr/local/apache2/bin/httpd -k start
nobody   22323  5198  0 06:54 ?        00:00:00 /usr/local/apache2/bin/httpd -k start
nobody   22324  5198  0 06:54 ?        00:00:00 /usr/local/apache2/bin/httpd -k start
nobody   22325  5198  0 06:54 ?        00:00:00 /usr/local/apache2/bin/httpd -k start
nobody   22331  5198  0 06:54 ?        00:00:00 /usr/local/apache2/bin/httpd -k start
nobody   22334  5198  0 06:54 ?        00:00:00 /usr/local/apache2/bin/httpd -k start
nobody   22335  5198  0 06:54 ?        00:00:00 /usr/local/apache2/bin/httpd -k start
nobody   22339  5198  0 06:54 ?        00:00:00 /usr/local/apache2/bin/httpd -k start
nobody   22340  5198  0 06:54 ?        00:00:00 /usr/local/apache2/bin/httpd -k start
nobody   22341  5198  0 06:54 ?        00:00:00 /usr/local/apache2/bin/httpd -k start
nobody   22342  5198  0 06:54 ?        00:00:00 /usr/local/apache2/bin/httpd -k start
nobody   22350  5198  0 06:54 ?        00:00:00 /usr/local/apache2/bin/httpd -k start
nobody   22351  5198  0 06:54 ?        00:00:00 /usr/local/apache2/bin/httpd -k start
nobody   22352  5198  0 06:54 ?        00:00:00 /usr/local/apache2/bin/httpd -k start
nobody   22353  5198  0 06:54 ?        00:00:00 /usr/local/apache2/bin/httpd -k start
nobody   22354  5198  0 06:54 ?        00:00:00 /usr/local/apache2/bin/httpd -k start
nobody   22355  5198  0 06:54 ?        00:00:00 /usr/local/apache2/bin/httpd -k start
nobody   22358  5198  0 06:54 ?        00:00:00 /usr/local/apache2/bin/httpd -k start
nobody   22359  5198  0 06:54 ?        00:00:00 /usr/local/apache2/bin/httpd -k start
nobody   22370  5198  0 06:54 ?        00:00:00 /usr/local/apache2/bin/httpd -k start
nobody   22371  5198  0 06:54 ?        00:00:00 /usr/local/apache2/bin/httpd -k start
nobody   22372  5198  0 06:54 ?        00:00:00 /usr/local/apache2/bin/httpd -k start
nobody   22373  5198  0 06:54 ?        00:00:00 /usr/local/apache2/bin/httpd -k start
nobody   22375  5198  0 06:54 ?        00:00:00 /usr/local/apache2/bin/httpd -k start
nobody   22376  5198  0 06:54 ?        00:00:00 /usr/local/apache2/bin/httpd -k start
nobody   22379  5198  0 06:54 ?        00:00:00 /usr/local/apache2/bin/httpd -k start
nobody   22380  5198  0 06:54 ?        00:00:00 /usr/local/apache2/bin/httpd -k start
nobody   22382  5198  0 06:54 ?        00:00:00 /usr/local/apache2/bin/httpd -k start
nobody   22386  5198  0 06:54 ?        00:00:00 /usr/local/apache2/bin/httpd -k start
nobody   22388  5198  0 06:54 ?        00:00:00 /usr/local/apache2/bin/httpd -k start
nobody   22392  5198  0 06:54 ?        00:00:00 /usr/local/apache2/bin/httpd -k start
nobody   22393  5198  0 06:54 ?        00:00:00 /usr/local/apache2/bin/httpd -k start
nobody   22394  5198  0 06:54 ?        00:00:00 /usr/local/apache2/bin/httpd -k start
nobody   22395  5198  0 06:54 ?        00:00:00 /usr/local/apache2/bin/httpd -k start
nobody   22399  5198  0 06:54 ?        00:00:00 /usr/local/apache2/bin/httpd -k start
nobody   22406  5198  0 06:54 ?        00:00:00 /usr/local/apache2/bin/httpd -k start
nobody   22407  5198  0 06:54 ?        00:00:00 /usr/local/apache2/bin/httpd -k start
nobody   22408  5198  0 06:54 ?        00:00:00 /usr/local/apache2/bin/httpd -k start
nobody   22427  5198  0 06:54 ?        00:00:00 /usr/local/apache2/bin/httpd -k start
nobody   22428  5198  0 06:54 ?        00:00:00 [httpd] <defunct>
nobody   22429  5198  0 06:54 ?        00:00:00 /usr/local/apache2/bin/httpd -k start
nobody   22430  5198  0 06:54 ?        00:00:00 /usr/local/apache2/bin/httpd -k start
nobody   22431  5198  0 06:54 ?        00:00:00 /usr/local/apache2/bin/httpd -k start
nobody   22432  5198  0 06:54 ?        00:00:00 /usr/local/apache2/bin/httpd -k start
nobody   22433  5198  0 06:54 ?        00:00:00 /usr/local/apache2/bin/httpd -k start
nobody   22434  5198  0 06:54 ?        00:00:00 /usr/local/apache2/bin/httpd -k start
nobody   22435  5198  0 06:54 ?        00:00:00 /usr/local/apache2/bin/httpd -k start
nobody   22437  5198  0 06:54 ?        00:00:00 /usr/local/apache2/bin/httpd -k start
nobody   22438  5198  0 06:54 ?        00:00:00 /usr/local/apache2/bin/httpd -k start
nobody   22439  5198  0 06:54 ?        00:00:00 /usr/local/apache2/bin/httpd -k start
nobody   22440  5198  0 06:54 ?        00:00:00 /usr/local/apache2/bin/httpd -k start
root     22442 22252  0 06:54 pts/0    00:00:00 grep -i httpd
[root@localhost usr]#


이번의 경우는 디스크가 가득 차서 발생한 문제로 사용하지 않는 로그나 파일들을 삭제 하여 해결 됨.

2016년 2월 19일 금요일

[LiNuX] sftp 로그를 남기자


root@localhost:~# vi /etc/ssh/sshd_config

Subsystem sftp /usr/lib/openssh/sftp-server -f local2 -l INFO

위의 내용이 없다면, 적당한 위치에 추가 하고 저장 하고 나온다.

root@localhost:~# vi /etc/rsyslog.conf
# sftp log
local2.*                        /var/log/sftp/sftp.log

적당한 위치에 위의 내용을 넣고 저장 하고 나온다.

root@localhost:~# /etc/init.d/rsyslog restart
[ ok ] Restarting rsyslog (via systemctl): rsyslog.service.
root@localhost:~# /etc/init.d/ssh restart
[ ok ] Restarting ssh (via systemctl): ssh.service.
root@localhost:~# tail -f /var/log/sftp/sftp.log
Feb 19 17:13:36 sftp-server[55648]: opendir "/home/freecatz"
Feb 19 17:13:36 sftp-server[55648]: closedir "/home/freecatz"
Feb 19 17:13:36 sftp-server[55648]: open "/home/freecatz/TEST.xml" flags READ mode 0666
Feb 19 17:13:36 sftp-server[55648]: close "/home/freecatz/TEST.xml" bytes read 59974 written 0
Feb 19 17:13:53 sftp-server[55648]: open "/home/freecatz/TEST2.xml" flags READ mode 0666
Feb 19 17:13:53 sftp-server[55648]: close "/home/freecatz/TEST2.xml" bytes read 326680 written 0
Feb 19 17:13:57 sftp-server[55648]: open "/home/freecatz/TEST3.xml" flags READ mode 0666
Feb 19 17:14:06 sftp-server[55648]: close "/home/freecatz/TEST3.xml" bytes read 24142026 written 0
Feb 19 17:14:26 sftp-server[55648]: session closed for local user freecatz from [192.168.0.10]
Feb 19 17:14:26 sftp-server[55644]: session closed for local user freecatz from [192.168.0.10]


2016년 2월 4일 목요일

[MySqL] UTF-8 설정

[client]
default-character-set = utf8

[mysqld]
init_connect = SET collation_connection = utf8_general_ci
init_connect = SET NAMES utf8
character-set-server = utf8
collation-server = utf8_general_ci

[mysqldump]
default-character-set = utf8

[mysql]
default-character-set = utf8

2016년 1월 6일 수요일

[EtC] 바이러스 테스트(Eicar Test)



텍스트 문서를 만들어서 아래의 내용을 입력 하고, 저장시 text.com 등과 같이 실행 가능한 파일의 확장자로 저장 한다.

X5O!P%@AP[4\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*


백신에서 바이러스로 판단하면 정상. 바이러스로 인식 하지 못하는 경우 백신에 문제가

있는 것.