同一台服务器里安装了多个mysql时,进入指定的mysql命令:
mysql -uroot -ppassword -S /tmp/mysql_port.sock -DdbName
远程登录mysql服务命令:
mysql -hIP -P3307 -ucutedb -ppassword dbName
或
/data1/mysql543_3307/bin/mysql -hIP -P3316 -udbUser -ppassword
操作sql: ./mysql -S /tmp/mysql_3310.sock -uroot -pxxxx -Dxxxx -e "select count(*),cu_level from tableName where date(cu_lastlogin)='2010-12-01' group by cu_level;" > /home/xxxx/db3310_thai.txt
memcached的重启命令:
ps -ax|grep memcached
kill -9 memcached_pid
/usr/local/bin/memcached -d -m 48 -u root -l 192.168.16.106 -p 11211 -U 11211 -c 40960 -P /tmp/memcached1.pid
以下是环境搭建:
添加用户:useradd
修改 /etc/sudoers 文件,添加如下信息:
root ALL=(ALL) ALL
xxxx ALL=(ALL) NOPASSWD:ALL
xxxx ALL=(ALL) NOPASSWD:ALL
xxxx ALL=(ALL) NOPASSWD:ALL
xxxx ALL=(ALL) NOPASSWD:ALL
xxxx ALL=(ALL) NOPASSWD:ALL
Ngnix 安装文档:
PCRE(Perl Compatible Regular Expressions)是一个Perl库,
包括perl兼容的正规表达式库.这些在执行正规表达式模式匹配时用与Perl 5同样的语法和语义是很有用的)
cd pcre-8.00
./configure
make
make install
cd ../
cd zlib-1.2.3;
./configure --prefix=/usr/local;
make;
make install;
/usr/sbin/useradd www -s /sbin/nologin 添加Ngnix www用户权限
cd nginx-0.8.29
./configure --prefix=/data/webserver/nginx0829 --user=www --group=www --with-http_stub_status_module --without-http-cache
make
make install
创建相关缓存目录
mkdir -p /data/appdatas/cute/htdocs;
mkdir -p /data/client_body_temp
mkdir -p /data/proxy_temp
chown -R nobody:nobody /data/* 目录赋权
Ngnix 启动和停止说明:
/data/webserver/nginx0829/sbin/nginx (启动)
/webserver/nginx0829/sbin/nginx -s stop (关闭)
Ngnix配置中信息添加:
allow 125.76.229.113;
allow 60.195.252.106;
allow 118.26.18.66;
allow 60.195.249.83;
deny all ;
Resin的安装:
首先要安装JDK
原 /usr/bin 下的java要进行改名,然后/usr下新建 java 目录
复制./jdk-6u17-linux-x64.bin 至该目录并进行安装
ln -s /usr/java/jdk1.6.0_17/bin/java /usr/bin/java
ll java
JAVA_HOME=/usr/java/jdk1.6.0_17
复制 tools.jar 到 resin下的lib
设置JAVA环境变量
将下列命令添加到/etc/profile
export JAVA_HOME=/usr/java/jdk1.6.0_17
export CLASSPATH=$JAVA_HOME/lib:$JAVA_HOME/lib/tools.jar
export PATH=$PATH:$JAVA_HOME/bin
改完要执行. /etc/profile
which java 用于查看 java的安装路径
cd /webserver/resin-3.0.22
./configure
make
make install
个别情况下会因为缺少库文件而不能编译,解决办法为:
yum -y install glibc-devel
$ vi startup.sh
. /etc/profile
ulimit -SHn 40960
./bin/httpd.sh -server s1 start
$ vi shutdown.sh
./bin/httpd.sh -server s1 stop
$ vi restart.sh
cd /data/resin-3.0.28
./bin/httpd.sh -server s1 stop
ulimit -SHn 40960
./bin/httpd.sh -server s1 start
将所有脚本权限设为可执行
$ chmod 755 *.sh
Memcached的安装:
(libevent是一个事件触发的网络库,适用于windows、linux、bsd等多种平台,mem要基于它安装)
cd libevent-2.0.3-alpha
./configure
make
make install
cd memcached-1.4.5
./configure
make
make install
vi /etc/ld.so.conf,添加以下内容
/usr/local/lib
/data1/mysql543_3307/lib
然后执行命令:/sbin/ldconfig
测试是否成功安装memcached:
# ls -al /usr/local/bin/mem*
-rwxr-xr-x 1 root root 137986 11?? 12 17:39 /usr/local/bin/memcached
-rwxr-xr-x 1 root root 140179 11?? 12 17:39 /usr/local/bin/memcached-debug
Memcached异常解决办法:
使用 LD_DEBUG=help ./memcached -v来确定 加载的类库路径,方法如下:
LD_DEBUG=libs ./memcached -v 2>&1 > /dev/null | less
我们看到,memcached会到很多地方去找,所以根据其它求,我们只需建一个软链接,指定到我们安装的类库上即可
方法如下:
ln -s /usr/local/lib/libevent-1.4.so.2 /lib/libevent-1.4.so.2
找不到gcc包的解决办法: yum -y install gcc 或 up2date -i gcc
memcached启动及关闭命令
startupmem.sh
/usr/local/bin/memcached -d -l 10.25.223.134 -p 11211 -m 4000 -u root -c 40960 -P /tmp/memcached.pid
shutdownmem.sh
kill `cat /tmp/memcached.pid`; (直接kill掉其ID进程号)
Mysql 安装方法:
Mysql用户权限的添加:
/usr/sbin/useradd -s /sbin/nologin mysql
chown -R mysql:mysql /data1/mysql543* 赋予数据库可执行权限
echo 'export PATH=$PATH:/data1/mysql543_3307/bin' >> /etc/profile
. /etc/profile
mysql的数据导入:
mysql -S /tmp/mysql_3316.sock -uroot -pxxxxxx dbName < /home/xxxxx/table_Define3316.sql
SNMP 安装方法:
./configure --prefix=/usr/local/snmp --with-openssl=/usr/ --with-mib-modules=ucd-snmp/diskio
make
make install
SNMP 用户添加
vi /usr/local/snmp/share/snmp/snmpd.conf Add 如下内容:
rocommunity jiankongebo 125.76.229.215
rocommunity jiankongebo 60.195.249.83
启动及关闭 :killall -9 snmpd /usr/local/snmp/sbin/snmpd
新增服务器添加开机自启动:
/usr/local/bin/memcached -d -l 216.93.177.44 -p 11211 -m 2000 -u root -c 40960 -P /tmp/memcached.pid
/webserver/nginx0829/sbin/nginx
cd /webserver/resin-3.0.22/;sh ./startup.sh
Mysql开机自启动中信息添加:
cd /data1/mysql543_3307/; ./mysqlctl start 3307
cd /data1/mysql543_3307/; ./mysqlctl start 3308
cd /data1/mysql543_3307/; ./mysqlctl start 3309
cd /data1/mysql543_3307/; ./mysqlctl start 3310
cd /data1/mysql543_3307/; ./mysqlctl start 3316
cd /data1/mysql543_3307/; ./mysqlctl start 3317
Monitor 监控信息的添加
mkdir -p /data/monitor
cd /data/monitor
vi loading.sh
#!/bin/sh
#set env
export PATH=/bin:/sbin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin:/root/bin:$HOME/bin
#sar -u -P ALL 2 5 >>/data1/monitor/cpu.txt 2>&1 &
sar -u 2 5 >>/data1/monitor/cpu.txt 2>&1 &
sar -r 2 5 >>/data1/monitor/memory.txt 2>&1 &
sar -b 2 5 >>/data1/monitor/io.txt 2>&1 &
sar 2 5 -n DEV -e >>/data1/monitor/dev.txt 2>&1 &
#!/bin/sh
#set env
export PATH=/bin:/sbin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin:/root/bin:$HOME/bin
#sar -u -P ALL 2 5 >>/data/monitor/cpu.txt 2>&1 &
sar -u 2 5 >>/data/monitor/cpu.txt 2>&1 &
sar -r 2 5 >>/data/monitor/memory.txt 2>&1 &
sar -b 2 5 >>/data/monitor/io.txt 2>&1 &
sar 2 5 -n DEV -e >>/data/monitor/dev.txt 2>&1 &
chmod 755 *.sh
#loading monitor
*/5 * * * * cd /data1/monitor/; sh ./loading.sh 2 >> loading.log 2>&1 &
#loading monitor
*/5 * * * * cd /data/monitor/; sh ./loading.sh 2 >> loading.log 2>&1 &
mv cpu.txt cpu.txt.20100930
mv dev.txt dev.txt.20100930
mv memory.txt memory.txt.20100930
mv io.txt io.txt.2010930
yum install sysstat 安装监控包
重启crontab命令
service crond restart
mysql -uroot -ppassword -S /tmp/mysql_port.sock -DdbName
远程登录mysql服务命令:
mysql -hIP -P3307 -ucutedb -ppassword dbName
或
/data1/mysql543_3307/bin/mysql -hIP -P3316 -udbUser -ppassword
操作sql: ./mysql -S /tmp/mysql_3310.sock -uroot -pxxxx -Dxxxx -e "select count(*),cu_level from tableName where date(cu_lastlogin)='2010-12-01' group by cu_level;" > /home/xxxx/db3310_thai.txt
memcached的重启命令:
ps -ax|grep memcached
kill -9 memcached_pid
/usr/local/bin/memcached -d -m 48 -u root -l 192.168.16.106 -p 11211 -U 11211 -c 40960 -P /tmp/memcached1.pid
以下是环境搭建:
添加用户:useradd
修改 /etc/sudoers 文件,添加如下信息:
root ALL=(ALL) ALL
xxxx ALL=(ALL) NOPASSWD:ALL
xxxx ALL=(ALL) NOPASSWD:ALL
xxxx ALL=(ALL) NOPASSWD:ALL
xxxx ALL=(ALL) NOPASSWD:ALL
xxxx ALL=(ALL) NOPASSWD:ALL
Ngnix 安装文档:
PCRE(Perl Compatible Regular Expressions)是一个Perl库,
包括perl兼容的正规表达式库.这些在执行正规表达式模式匹配时用与Perl 5同样的语法和语义是很有用的)
cd pcre-8.00
./configure
make
make install
cd ../
cd zlib-1.2.3;
./configure --prefix=/usr/local;
make;
make install;
/usr/sbin/useradd www -s /sbin/nologin 添加Ngnix www用户权限
cd nginx-0.8.29
./configure --prefix=/data/webserver/nginx0829 --user=www --group=www --with-http_stub_status_module --without-http-cache
make
make install
创建相关缓存目录
mkdir -p /data/appdatas/cute/htdocs;
mkdir -p /data/client_body_temp
mkdir -p /data/proxy_temp
chown -R nobody:nobody /data/* 目录赋权
Ngnix 启动和停止说明:
/data/webserver/nginx0829/sbin/nginx (启动)
/webserver/nginx0829/sbin/nginx -s stop (关闭)
Ngnix配置中信息添加:
allow 125.76.229.113;
allow 60.195.252.106;
allow 118.26.18.66;
allow 60.195.249.83;
deny all ;
Resin的安装:
首先要安装JDK
原 /usr/bin 下的java要进行改名,然后/usr下新建 java 目录
复制./jdk-6u17-linux-x64.bin 至该目录并进行安装
ln -s /usr/java/jdk1.6.0_17/bin/java /usr/bin/java
ll java
JAVA_HOME=/usr/java/jdk1.6.0_17
复制 tools.jar 到 resin下的lib
设置JAVA环境变量
将下列命令添加到/etc/profile
export JAVA_HOME=/usr/java/jdk1.6.0_17
export CLASSPATH=$JAVA_HOME/lib:$JAVA_HOME/lib/tools.jar
export PATH=$PATH:$JAVA_HOME/bin
改完要执行. /etc/profile
which java 用于查看 java的安装路径
cd /webserver/resin-3.0.22
./configure
make
make install
个别情况下会因为缺少库文件而不能编译,解决办法为:
yum -y install glibc-devel
$ vi startup.sh
. /etc/profile
ulimit -SHn 40960
./bin/httpd.sh -server s1 start
$ vi shutdown.sh
./bin/httpd.sh -server s1 stop
$ vi restart.sh
cd /data/resin-3.0.28
./bin/httpd.sh -server s1 stop
ulimit -SHn 40960
./bin/httpd.sh -server s1 start
将所有脚本权限设为可执行
$ chmod 755 *.sh
Memcached的安装:
(libevent是一个事件触发的网络库,适用于windows、linux、bsd等多种平台,mem要基于它安装)
cd libevent-2.0.3-alpha
./configure
make
make install
cd memcached-1.4.5
./configure
make
make install
vi /etc/ld.so.conf,添加以下内容
/usr/local/lib
/data1/mysql543_3307/lib
然后执行命令:/sbin/ldconfig
测试是否成功安装memcached:
# ls -al /usr/local/bin/mem*
-rwxr-xr-x 1 root root 137986 11?? 12 17:39 /usr/local/bin/memcached
-rwxr-xr-x 1 root root 140179 11?? 12 17:39 /usr/local/bin/memcached-debug
Memcached异常解决办法:
使用 LD_DEBUG=help ./memcached -v来确定 加载的类库路径,方法如下:
LD_DEBUG=libs ./memcached -v 2>&1 > /dev/null | less
我们看到,memcached会到很多地方去找,所以根据其它求,我们只需建一个软链接,指定到我们安装的类库上即可
方法如下:
ln -s /usr/local/lib/libevent-1.4.so.2 /lib/libevent-1.4.so.2
找不到gcc包的解决办法: yum -y install gcc 或 up2date -i gcc
memcached启动及关闭命令
startupmem.sh
/usr/local/bin/memcached -d -l 10.25.223.134 -p 11211 -m 4000 -u root -c 40960 -P /tmp/memcached.pid
shutdownmem.sh
kill `cat /tmp/memcached.pid`; (直接kill掉其ID进程号)
Mysql 安装方法:
Mysql用户权限的添加:
/usr/sbin/useradd -s /sbin/nologin mysql
chown -R mysql:mysql /data1/mysql543* 赋予数据库可执行权限
echo 'export PATH=$PATH:/data1/mysql543_3307/bin' >> /etc/profile
. /etc/profile
mysql的数据导入:
mysql -S /tmp/mysql_3316.sock -uroot -pxxxxxx dbName < /home/xxxxx/table_Define3316.sql
SNMP 安装方法:
./configure --prefix=/usr/local/snmp --with-openssl=/usr/ --with-mib-modules=ucd-snmp/diskio
make
make install
SNMP 用户添加
vi /usr/local/snmp/share/snmp/snmpd.conf Add 如下内容:
rocommunity jiankongebo 125.76.229.215
rocommunity jiankongebo 60.195.249.83
启动及关闭 :killall -9 snmpd /usr/local/snmp/sbin/snmpd
新增服务器添加开机自启动:
/usr/local/bin/memcached -d -l 216.93.177.44 -p 11211 -m 2000 -u root -c 40960 -P /tmp/memcached.pid
/webserver/nginx0829/sbin/nginx
cd /webserver/resin-3.0.22/;sh ./startup.sh
Mysql开机自启动中信息添加:
cd /data1/mysql543_3307/; ./mysqlctl start 3307
cd /data1/mysql543_3307/; ./mysqlctl start 3308
cd /data1/mysql543_3307/; ./mysqlctl start 3309
cd /data1/mysql543_3307/; ./mysqlctl start 3310
cd /data1/mysql543_3307/; ./mysqlctl start 3316
cd /data1/mysql543_3307/; ./mysqlctl start 3317
Monitor 监控信息的添加
mkdir -p /data/monitor
cd /data/monitor
vi loading.sh
#!/bin/sh
#set env
export PATH=/bin:/sbin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin:/root/bin:$HOME/bin
#sar -u -P ALL 2 5 >>/data1/monitor/cpu.txt 2>&1 &
sar -u 2 5 >>/data1/monitor/cpu.txt 2>&1 &
sar -r 2 5 >>/data1/monitor/memory.txt 2>&1 &
sar -b 2 5 >>/data1/monitor/io.txt 2>&1 &
sar 2 5 -n DEV -e >>/data1/monitor/dev.txt 2>&1 &
#!/bin/sh
#set env
export PATH=/bin:/sbin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin:/root/bin:$HOME/bin
#sar -u -P ALL 2 5 >>/data/monitor/cpu.txt 2>&1 &
sar -u 2 5 >>/data/monitor/cpu.txt 2>&1 &
sar -r 2 5 >>/data/monitor/memory.txt 2>&1 &
sar -b 2 5 >>/data/monitor/io.txt 2>&1 &
sar 2 5 -n DEV -e >>/data/monitor/dev.txt 2>&1 &
chmod 755 *.sh
#loading monitor
*/5 * * * * cd /data1/monitor/; sh ./loading.sh 2 >> loading.log 2>&1 &
#loading monitor
*/5 * * * * cd /data/monitor/; sh ./loading.sh 2 >> loading.log 2>&1 &
mv cpu.txt cpu.txt.20100930
mv dev.txt dev.txt.20100930
mv memory.txt memory.txt.20100930
mv io.txt io.txt.2010930
yum install sysstat 安装监控包
重启crontab命令
service crond restart