virtual_server vip 53 { delay_loop 2 lb_algo rr lb_kind DR protocol UDP real_server real_server1 53 { weight 100 MISC_CHECK { misc_path "/etc/keepalived/check_named.sh real_server1" misc_timeout 5 } } real_server real_server2 53 { weight 100 MISC_CHECK { misc_path "/etc/keepalived/check_named.sh real_server2" misc_timeout 5 } } }
#!/bin/bash SERVER=$1 OK=`nslookup www.test.com $SERVER|grep ipxxxx` if [ "$OK" == "" ] ; then exit 1; else exit 0; fi
Name: Vipshop-Bind-Chroot Summary: This is for Vipshop dns server. Group: System Environment/Daemons Version: 1.0 Release: 0 License: Copyright 2011 Vipshop Inc. Source: Vipshop-Bind-Chroot-1.0.tar.gz URL: http://www.vipshop.com Packager: EricNi Vendor: Vipshop Inc. Provides: Vipshop Inc. BuildRequires: gcc-c++ %description This is DNS Service pakeage , and it only distributed in Vipshop Servers . %prep test -d /usr/local/named && rm -rf /usr/local/named [ `cat /etc/passwd|grep named|wc -l` -eq 0 ] && useradd named -M -s /sbin/nologin mkdir -p /usr/local/named /usr/local/named/var/slaves /usr/local/named/var/named /usr/local/named/var/etc /usr/local/named/var/log mkdir -p /var/named/chroot/etc/namedb /var/named/chroot/etc/log /var/named/chroot/etc/run /var/named/chroot/var/run /var/named/chroot/dev/ /var/named/chroot/etc/namedb/slaves /var/named/chroot/etc/namedb/acl %setup -n %{name}-%{version} %build export BIND_HOME=/usr/local/named export BIND_CHROOT_HOME=/var/named/chroot ./configure --prefix=${BIND_HOME} --enable-threads --sysconfdir=/etc --disable-openssl-version-check make make install cat > ${BIND_CHROOT_HOME}/etc/named.conf << "EOF" options { directory "/etc/namedb"; version "vipshop-cdn-dns"; pid-file "/etc/run/named.pid"; listen-on port 53 {any;}; allow-query {any;}; recursion yes; dump-file "/etc/namedb/cache_dump.db"; zone-statistics yes; statistics-file "/etc/namedb/named_stats.txt"; }; logging { channel warning {file "/etc/log/named.log" versions 3 size 2048k; severity warning; print-severity yes; print-category yes; print-time yes; }; channel query {file "/etc/log/query.log" versions 3 size 2048k; severity info; print-category yes; print-severity yes; print-time yes; }; category queries { query; }; category default { warning; }; }; zone "." IN { type hint; file "named.root"; }; zone "localhost" IN { type master; file "localhost.zone"; }; zone "0.0.127.in-addr.arpa" IN { type master; file "slaves/localhost.rev"; }; zone "vipshop.com" IN { type master; file "vipshop.zone"; notify yes; also-notify {180.186.22.62;}; allow-transfer { 180.186.22.62; }; }; key "rndc-key" { algorithm hmac-md5; secret "f8Na2kl/4NuCNPEZ0f2C1Q=="; }; controls { inet 127.0.0.1 port 953 allow { 127.0.0.1; } keys { "rndc-key"; }; }; EOF cat > ${BIND_CHROOT_HOME}/etc/rndc.conf << "EOF" key "rndc-key" { algorithm hmac-md5; secret "f8Na2kl/4NuCNPEZ0f2C1Q=="; }; options { default-key "rndc-key"; default-server 127.0.0.1; default-port 953; }; EOF cat > ${BIND_CHROOT_HOME}/etc/rndc.key << "EOF" key "rndc-key" { algorithm hmac-md5; secret "f8Na2kl/4NuCNPEZ0f2C1Q=="; }; EOF cat > /etc/rndc.conf << "EOF" key "rndc-key" { algorithm hmac-md5; secret "f8Na2kl/4NuCNPEZ0f2C1Q=="; }; options { default-key "rndc-key"; default-server 127.0.0.1; default-port 953; }; EOF cat > ${BIND_CHROOT_HOME}/etc/namedb/named.root << "EOF" ; This file holds the information on root name servers needed to ; initialize cache of Internet domain name servers ; (e.g. reference this file in the "cache . <file>" ; configuration file of BIND domain name servers). ; ; This file is made available by InterNIC ; under anonymous FTP as ; file /domain/named.cache ; on server FTP.INTERNIC.NET ; -OR- RS.INTERNIC.NET ; ; last update: Jan 3, 2013 ; related version of root zone: 2013010300 ; ; formerly NS.INTERNIC.NET ; . 3600000 IN NS A.ROOT-SERVERS.NET. A.ROOT-SERVERS.NET. 3600000 A 198.41.0.4 A.ROOT-SERVERS.NET. 3600000 AAAA 2001:503:BA3E::2:30 ; ; FORMERLY NS1.ISI.EDU ; . 3600000 NS B.ROOT-SERVERS.NET. B.ROOT-SERVERS.NET. 3600000 A 192.228.79.201 ; ; FORMERLY C.PSI.NET ; . 3600000 NS C.ROOT-SERVERS.NET. C.ROOT-SERVERS.NET. 3600000 A 192.33.4.12 ; ; FORMERLY TERP.UMD.EDU ; . 3600000 NS D.ROOT-SERVERS.NET. D.ROOT-SERVERS.NET. 3600000 A 199.7.91.13 D.ROOT-SERVERS.NET. 3600000 AAAA 2001:500:2D::D ; ; FORMERLY NS.NASA.GOV ; . 3600000 NS E.ROOT-SERVERS.NET. E.ROOT-SERVERS.NET. 3600000 A 192.203.230.10 ; ; FORMERLY NS.ISC.ORG ; . 3600000 NS F.ROOT-SERVERS.NET. F.ROOT-SERVERS.NET. 3600000 A 192.5.5.241 F.ROOT-SERVERS.NET. 3600000 AAAA 2001:500:2F::F ; ; FORMERLY NS.NIC.DDN.MIL ; . 3600000 NS G.ROOT-SERVERS.NET. G.ROOT-SERVERS.NET. 3600000 A 192.112.36.4 ; ; FORMERLY AOS.ARL.ARMY.MIL ; . 3600000 NS H.ROOT-SERVERS.NET. H.ROOT-SERVERS.NET. 3600000 A 128.63.2.53 H.ROOT-SERVERS.NET. 3600000 AAAA 2001:500:1::803F:235 ; ; FORMERLY NIC.NORDU.NET ; . 3600000 NS I.ROOT-SERVERS.NET. I.ROOT-SERVER构建企业级LAMMP环境 阅读原文»构建企业级LAMMP环境一、LAMMP简介
二、LAMMP项目环境简介
三、Apache的安装与配置
四、FastCGI的安装与配置
五、整合Apache与PHP服务
六、安装Mysql服务器
七、安装Memcache与libevent
八、安装Memcache 基于Web管理平台
一、LAMMP简介
LAMP(Linux- Apache-MySQL-PHP)网站架构是目前国际流行的Web框架,该框架包括:Linux操作系统,Apache网络服务器,MySQL数据 库,Perl、PHP或者Python编程语言,所有组成产品均是开源软件,是国际上成熟的架构框架,很多流行的商业应用都是采取这个架构,和 Java/J2EE架构相比,LAMP具有Web资源丰富、轻量、快速开发等特点,微软的.NET架构相比,LAMP具有通用、跨平台、高性能、低价格的 优势,因此LAMP无论是性能、质量还是价格都是企业搭建网站的首选平台。在此基础上我们增加了Memcache缓冲服务器,解决了应用程序与数据库之间的瓶颈问题,有效提高了访问速度,这就是LAMMP架构。
二、LAMMP项目环境简介
系统环境:centos6.4-x86_64
所需软件以及下载地址:memcache-2.2.7 (http://www.pecl.php.net/package/memcache) memcached-1.4.17.tar.gz (http://www.memcached.org/ ) apr-1.4.6、apr-util-1.5.1、httpd-2.4.4(http://pan.baidu.com/s/1pJFGBlL ) php-5.5.8、mysql-5.6.15-linux-glibc2.5-x86_64、libevent-2.0.16-stable(http://pan.baidu.com/s/1bnrcENd)
拓扑图:
ip地址规划:
httpd+php服务器:192.168.29.20 192.168.29.30
memcached服务器: 192.168.29.40
mysql服务器:192.168.29.50
三、Apache的安装与配置
准备系统环境:
[root@nddnd ~]# yum --disablerepo=\* --enablerepo=c6-media groupinstall "Development tools"
[root@nddnd ~]# yum --disablerepo=\* --enablerepo=c6-media install pcre-devel
安装apr
[root@nddnd ~]# tar -zxvf apr-1.4.6.tar.gz -C /usr/local/src/
[root@nddnd apr-1.4.6]# ./configure --prefix=/usr/local/apr
[root@nddnd apr-1.4.6]# make && make install
安装apr-util
[root@nddnd ~]# tar -zxvf apr-util-1.5.1.tar.gz -C /usr/local/src
[root@nddnd apr-util-1.5.1]# ./configure --prefix=/usr/local/apr-util --with
-apr=/usr/local/apr/bin/apr-1-config
[root@nddnd apr-util-1.5.1]# make && make install
安装Apache
[root@nddnd ~]# tar -jxvf httpd-2.4.4.tar.bz2 -C /usr/local/src
[root@nddnd httpd-2.4.4]#./configure --prefix=/usr/local/apache\
--sysconfdir=/etc/httpd
--enable-so \
--enable-rewrite \
--with-apr=/usr/local/apr/bin/apr-1-config \
--with-apr-util=/usr/local/apr-util/bin/apu-1-config \
--with-pcre \
--with-z \
--enable-mpms-shared=all \
--with-mpm=event
[root@nddnd httpd-2.4.4]# make && make install
编写httpd控制脚本/etc/init.d/httpd,内容如下
#!/bin/bash
#chkconfig: 2345 88 40
#description: the server is httpd server
prog=/usr/local/apache/bin/httpd
lockfile=/var/lock/subsys/httpd
start(){
if [ -e $lockfile ];then
echo "httpd server isstarted"
else echo -n "httpd server isstarting... "
sleep 1
$prog -k start &>/dev/null && echo "[ ok ]" && touch $lockfile||echo "[ failer ]"
fi
}
stop(){
if [ ! -e $lockfile ];then
echo "httpd server is stoped"
else echo -n "httpd server isstoping... "
sleep 1
$prog -k stop && echo "[ok ]" && rm -rf $lockfile ||echo "[ failer ]"
fi
}
status(){
if [ -e $lockfile ];then
echo "httpd server isstarted"
else echo "httpd server no found"
fi
}
case $1 in
start)
没有评论:
发表评论