# kill -SIGUSR1 `cat /var/run/mongodb.pid`
用在shell脚本里时,命令要改成这样: kill -USR1 `cat /var/run/mongodb.pid`
参考:http://www.mongodb.org/display/DOCS/Logging#Logging-Rotatingthelogfiles
# kill -SIGUSR1 `cat /var/run/mongodb.pid`
用在shell脚本里时,命令要改成这样: kill -USR1 `cat /var/run/mongodb.pid`
参考:http://www.mongodb.org/display/DOCS/Logging#Logging-Rotatingthelogfiles
很多人都说自己编译的稳定好用,我也来试试:
1. 参考官方文档,手工编译Spider Monkey
# curl -O ftp://ftp.mozilla.org/pub/mozilla.org/js/js-1.7.0.tar.gz
# tar zxvf js-1.7.0.tar.gz
# cd js/src
# export CFLAGS="-DJS_C_STRINGS_ARE_UTF8"
# make -f Makefile.ref
# JS_DIST=/usr make -f Makefile.ref export
2. 安装scons,用官网的rpm包就行。
3. 重新编译pcre。自带的编译时没带--enable-unicode-properties参数,mongdb启动时会提示:warning: some regex utf8 things will not work. pcre build doesn't have --enable-unicode-properties. RPMS包是在这里找到的。
# rpm -ivh pcre-6.6-2.el5_1.7.src.rpm
# vi /usr/src/redhat/SPECS/pcre.spec
%configure --enable-utf8
修改成
%configure --enable-utf8 --enable-unicode-properties
# rpmbuild -ba /usr/src/redhat/SPECS/pcre.spec
# rpm -Uvh /usr/src/redhat/RPMS/x86_64/pcre*.rpm
4. 安装1.41版本的boost库。这里可以找到编译好的boost库的RPM包。因为后面要编译成静态库,还需要安装boost141-static-1.41.0-2.el5.i386.rpm
5. 开始编译MongoDB
# cd mongodb-src-r1.8.1
# scons --libpath=/usr/lib64/boost141/ \
--cpppath=/usr/include/boost141/ \
--release --64 --static all
如果你没有--release和--static选项,可能会看见下面这样的消息
*** notice: no readline library, mongo shell will not have nice interactive line editing ***
解决方法是加上--extralib=ncurses。
6. 安装
# cd mongodb-src-r1.8.1
# scons --libpath=/usr/lib64/boost141/ \
--cpppath=/usr/include/boost141/ \
--release --64 --static --prefix=/opt/mongo-1.8.1 install
参考:
1. http://www.mongodb.org/display/DOCS/Building+for+Linux
2. http://hi.baidu.com/farmerluo/blog/item/37364623f35ba55e9922ed2f.html
1. create tablespace
$ mkdir -p /home/postgresql/data
$ sudo chown -R postres:postres /home/postgresql/data
$ sudo chmod -R og-rx /home/postgresql/data
$ sudo su - postgres
$ psql
postgres=# create tablespace newspace location '/home/postgresql/data';
2. move a database to this new tablespace
use a php script from here to generate sql
$ sudo yum install php-pgsql
$ ./generate-mv-db.php
$ sudo su - postgres
$ psql -d mydb -f migrate_localhost_mydb_newspace.sql
3. install postgis
a. install proj4.7
$ sudo yum install proj
b. install geos 3.2.2
$ tar xvjf geos-3.2.2.tar.bz2
$ cd geos-3.2.2
$ ./configure --prefix=/usr
$ make && sudo make install
$ sudo ldconfig
must do this, otherwise postgis will fail to locate libgeos_c.so.1
c. install postgis-1.5.1.tar.gz
$ tar xvzf postgis-1.5.1.tar.gz
$ cd postgis-1.5.1
$ ./configure
$ make && sudo make install
d. create a spatially-enabled database
$ sudo su - postgres
$ createdb postgis_template -U postgres;
$ cd /usr/share/pgsql/contrib/postgis-1.5
$ createlang plpgsql postgis_template
$ psql -d postgis_template -f postgis.sql
$ psql -d postgis_template -f spatial_ref_sys.sql
用SSH登录远程主机,每次都输入密码挺麻烦的,其实可以用密钥文件来登录:
1. 用ssh-keygen命令生成private/public密钥对,提示问题都用默认回答即可。
$ ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/home/guoyong/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/guoyong/.ssh/id_rsa.
Your public key has been saved in /home/guoyong/.ssh/id_rsa.pub.
2. 用ssh-copy-id命令把公钥复制到远程主机上,user就是你登录用的用户名
$ ssh-cody-id user@remotehost
3. 验证一下吧
$ ssh user@remotehost echo "it works"
NRPE的作用是在远程主机上运行Nagios插件,以便监控远程主机。
Ubuntu Server下安装NRPE很方便:
$ sudo apt-get install nagios-nrpe-server nagios-plugins
默认的几个检查命令(check_users, check_load等)都已经在/etc/naigos/nrpe.cfg和/etc/nagios/nrpe_local.cfg配置好了。在Nagios里配置监控服务使用类似如下的监控命令就可以了:
check_command check_nrpe!check_load
如果需要自定义监控命令,只需在/etc/nagios/nrpe_local.cfg里设置,重启NRPE服务,再在Nagios里配置监控服务即可。比如,要添加一个监控TCP各种状态的命令,步骤如下:
@remotehost
$ cd /usr/lib/nagios/plugins
$ sudo wget http://www.tuschy.com/nagios/plugins/check_tcp_count
$ sudo chmod +x check_tcp_count
$ cd /etc/nagios
$ sudo vi nrpe_local.cfg
command[check_tcp_count]=/usr/lib/nagios/plugins/check_tcp_count
$ sudo service nagios-nrpe-server restart
@nagioshost
$ sudo vi remotehost.cfg
define service{
use generic-service
host_name remotehostname
service_description Tcp count
check_command check_nrpe!check_tcp_count
}