«   2018/09   »
            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            
Archives
Today
289
Total
1,153,510
안정적인 DNS서비스 DNSEver
관리 메뉴

Blue Breeze

centos php-fpm session.save_handler redis setting 본문

Language/PHP

centos php-fpm session.save_handler redis setting

푸른바람 C/H 2017.03.02 08:30
# 설치 확인
php -r "if (new Redis() == true){ echo \"OK \r\n\"; }"

# php redis 확인
yum list | egrep "php.*redis"
php-nrk-Predis.noarch                   1.0.4-1.el7                    epel
php-pecl-redis.x86_64                   2.2.8-1.el7                    epel
php-phpiredis.x86_64                    1.0.0-2.el7                    epel
php54-php-pecl-redis.x86_64             3.1.1-1.el7.remi               remi-safe
php54-php-phpiredis.x86_64              1.0.0-1.el7.remi               remi-safe
php55-php-pecl-redis.x86_64             3.1.1-1.el7.remi               remi-safe
php55-php-phpiredis.x86_64              1.0.0-1.el7.remi               remi-safe
php56-php-pecl-redis.x86_64             3.1.1-1.el7.remi               remi-safe
php56-php-phpiredis.x86_64              1.0.0-1.el7.remi               remi-safe
php70-php-pecl-redis.x86_64             3.1.1-1.el7.remi               remi-safe
php70-php-phpiredis.x86_64              1.0.0-1.el7.remi               remi-safe
php71-php-pecl-redis.x86_64             3.1.1-1.el7.remi               remi-safe
php71-php-phpiredis.x86_64              1.0.0-2.el7.remi               remi-safe

# 설치
sudo yum --enablerepo=epel,remi,remi-php70 install -y php-pecl-redis

/etc/php.ini session handler setting

session.save_handler = redis 
session.save_path    = "tcp://127.0.0.1:6379?auth=&database=10""
; In case you are using queued tracking or Redis as a cache: Make sure to configure a different database! Otherwise queued requests will be flushed

; 멀티서버 설정
; multiple servers can be configured comma separated
; session.save_path = "tcp://host1:6379?weight=1&database=2, tcp://host2:6379?weight=2&timeout=2.5, tcp://host3:6379?weight=2"

/etc/php-fpm.d/www.conf

php_value[session.save_handler] = redis
php_value[session.save_path]    = "tcp://127.0.0.1:6379"

Redis 설치

yum install redis -y

systemctl enable redis.service
systemctl start redis.service

redis-cli ping
redis-benchmark -q -n 1000 -c 10 -P 5

tail -f /var/log/redis/redis.log
# 경고 내용확인
# /etc/sysctl.conf 관련 메세지
vi /etc/sysctl.conf
# vm.overcommit_memory = 1 # 내용 추가 후 저장
# sysctl vm.overcommit_memory=1
sysctl vm.overcommit_memory=1

# echo never > /sys/kernel/mm/transparent_hugepage/enabled 관련 메세지
cat /sys/kernel/mm/transparent_hugepage/enabled 
# [always] madvise never
echo never > /sys/kernel/mm/transparent_hugepage/enabled
cat /sys/kernel/mm/transparent_hugepage/enabled 
# always madvise [never]

# reboot 후에 실행 되도록 설정
vi /etc/rc.local
echo never > /sys/kernel/mm/transparent_hugepage/enabled

# /proc/sys/net/core/somaxconn 관련 메세지
sysctl -w net.core.somaxconn=65535

# Increased maximum number of open files to 10032 (it was originally set to 1024). 메세지
# /etc/security/limits.conf 내용 추가
vi /etc/security/limits.conf
#{username} soft nofile 65536
redis soft nofile 65536
redis hard nofile 65536
redis soft nproc 131072
redis hard nproc 131072

reboot

# 보안해제
firewall-cmd --zone=public --permanent --add-port=6379/tcp

/etc/redis.conf

requirepass {레디스비밀번호}


0 Comments
댓글쓰기 폼