Redis extension installation deployment for Redis and PHP

Source: Internet
Author: User

One. Redis installation deployment:

Tar XF redis-3.2.8.tar.gz

CD redis-3.2.8

Make Manifesto=jemalloc

Make prefix=/usr/local/redis-3.2.8 Install

Ln-s/usr/local/redis-3.2.8//usr/local/redis

echo "Export path=/usr/local/redis/bin: $PATH" >>/etc/profile

Find/-name "redis.conf"

cp/opt/redis-3.2.8/redis.conf/usr/local/redis/conf/


Start Redis

Redis-server/usr/local/redis/conf/redis.conf


Troubleshooting Redis Boot Alert issues:

Vm.overcommit_memory = 1

To open a self-boot file:


[Email protected] ~]# tail-3/etc/rc.local

echo Never >/sys/kernel/mm/transparent_hugepage/enabled

Redis-server/usr/local/redis/conf/redis.conf


Two. Redis Basic security Optimizations:

The following configuration files are basic security optimizations:


[Email protected] ~]# grep-ve "#|^$"/usr/local/redis/conf/redis.conf

Bind 0.0.0.0

Protected-mode Yes

Port 123456

Tcp-backlog 511

Timeout 30

Tcp-keepalive 300

Daemonize Yes

Supervised no

Pidfile/var/run/redis123456.pid

LogLevel Warning

LogFile "/data/redis/log/redis.log"

Databases 16

Stop-writes-on-bgsave-error Yes

Rdbcompression Yes

Rdbchecksum Yes

Dbfilename Dump.rdb

Requirepass (23+_%^$34)

Dir/data/redis/data

Slave-serve-stale-data Yes

Slave-read-only Yes

Repl-diskless-sync No

Repl-diskless-sync-delay 5

Repl-disable-tcp-nodelay No

Slave-priority 100

MaxMemory 2g

AppendOnly Yes

Appendfilename "Appendonly.aof"

Appendfsync everysec

No-appendfsync-on-rewrite No

Auto-aof-rewrite-percentage 100

Auto-aof-rewrite-min-size 64MB

aof-load-truncated Yes

Lua-time-limit 5000

Slowlog-log-slower-than 10000

Slowlog-max-len 128

Latency-monitor-threshold 0

Notify-keyspace-events ""

Hash-max-ziplist-entries 512

Hash-max-ziplist-value 64

List-max-ziplist-size-2

List-compress-depth 0

Set-max-intset-entries 512

Zset-max-ziplist-entries 128

Zset-max-ziplist-value 64

Hll-sparse-max-bytes 3000

activerehashing Yes

Client-output-buffer-limit Normal 0 0 0

Client-output-buffer-limit slave 256MB 64MB 60

Client-output-buffer-limit pubsub 32MB 8MB 60

Hz 10

Aof-rewrite-incremental-fsync Yes




Two. Php-redis Extended installation:

wget Https://github.com/nicolasff/phpredis/archive/master.zip


CP master.zip/tmp/

cd/tmp/

Unzip Master.zip && CD Phpredis-master

/usr/local/php/bin/phpize

cd/tmp/phpredis-master/

Find/-name "Php-config"

./configure--with-php-config=/usr/local/php/bin/php-config

Make

Make install

echo "extension = redis.so" >>/usr/local/php/etc/php.ini


/ETC/INIT.D/PHP-FPM restart

Test:

Cat test.php

<?php

Phpinfo ();

?>


This article from the "10931853" blog, reproduced please contact the author!

Redis extension installation deployment for Redis and PHP

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.