LNMP+MEM+Redis架构部署(扩展)(3)

3.1、下载安装包

下载 memcached-1.4.15.tar.gz 安装包

wget

3.2、安装依赖关系

yum install libevent libevent-devel -y

3.3、编译安装

cd /app/

tar -xvzf memcached-1.4.15.tar.gz

cd memcached-1.4.15

./configure

make

make install

memcached -d -m 64 -u root -p 11211 -c 10000 -P /tmp/memcached.pid

---------------------------------------------------------------------

start::

memcached -d -m 64 -u root -p 11211 -c 10000 -P /tmp/memcached.pid

shutdown:

kill `cat /tmp/memcached.pid`

----------------------------------------------------------------------

启动参数解析

d选项是启动一个守护进程,

-m是分配给Memcache使用的内存数量,单位是MB,我这里是10MB,

-u是运行Memcache的用户,我这里是root,

-l是监听的服务器IP地址,如果有多个地址的话,我这里指定了服务器的IP地址192.168.0.200,

-p是设置Memcache监听的端口,我这里设置了12000,最好是1024以上的端口,

-c选项是最大运行的并发连接数,默认是1024,我这里设置了256,按照你服务器的负载量来设定,

-P是设置保存Memcache的pid文件,我这里是保存在 /tmp/memcached.pid,

####################################################################################

php安装

4.1、下载安装包

wget :8080/src/php-5.4.23.tar.gz

4.2、安装依赖关系

yum -y install libmcrypt libmcrypt-devel

编译安装

tar zxvf php-5.4.23.tar.gz

cd php-5.4.23

./configure --prefix=/usr/local/php --enable-fpm --with-mcrypt --with-openssl \

--enable-mbstring --enable-pdo --with-curl --disable-debug --disable-rpath \

--enable-inline-optimization --with-bz2 --with-zlib --enable-sockets \

--enable-sysvsem --enable-sysvshm --enable-pcntl --enable-mbregex \

--with-mhash --enable-zip --with-pcre-regex --with-MySQL --with-mysqli \

--with-gd --with-jpeg-dir

make

make test

make install

sh /bin/iptables.sh

启动

/usr/local/php/sbin/php-fpm -c /usr/local/php/etc/php-fpm.conf

cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf

yum安装php

iptables -F

yum install -y httpd

yum -y install --enablerepo=remi php

yum -y install --enablerepo=remi php-pdo

yum -y install --enablerepo=remi php-mysql

yum -y install --enablerepo=remi php-pear

yum -y install --enablerepo=remi php-mcrypt

yum -y install --enablerepo=remi php-pear-DB

yum -y install --enablerepo=remi php-mbstring

yum -y install --enablerepo=remi php-devel

yum -y install --enablerepo=remi php-gd

yum -y install --enablerepo=remi zlib-devel

yum -y install --enablerepo=remi pcre-devel

yum --enablerepo=remi install php-memcache

printf "\n" | pecl install apc

printf "\n" | pecl install memcache

pecl install Redis

yum -y remove libmcrypt

yum -y install libmcrypt libmcrypt-devel

sh /bin/iptables.sh

####################################################################################

redis的安装

5.1、下载安装包

wget :8080/src/redis-2.8.3.tar.gz

5.2、编译安装

tar zxvf redis-2.8.3.tar.gz

cd redis-2.8.3

make

make install

5.3、配置参数:redis.conf

vim /usr/local/redis/etc/redis.conf

---------------------------------------------------------

#!/bin/bash

daemonize yes

pidfile /usr/local/redis/var/redis.pid

port 6379

timeout 300

loglevel debug

logfile /usr/local/redis/var/redis.log

databases 16

save 900 1

save 300 10

save 60 10000

rdbcompression yes

dbfilename dump.rdb

dir /usr/local/redis/var/

appendonly no

appendfsync always

glueoutputbuf yes

shareobjects no

shareobjectspoolsize 1024

---------------------------------------------------------------------------

cp /usr/local/redis/etc/redis.conf /app/redis-2.8.3/redis.conf

启动redis

cd /app/redis-2.6.7/src/

./redis-server

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/e269132eddcea9094bf4d5a8f2426837.html