# 下载 BDB 4.7.25
wget http://download.oracle.com/berkeley-db/db-4.7.25.tar.gz
# 解压 BDB 4.7.25
tar -xvf db-4.7.25.tar.gz
# 进入目录
cd db-4.7.25/build_unix/
# 配置检测
./configure
# 编译(会有提示让你输入管理员密码)
sudo make
# 安装(会有提示让你输入管理员密码)
sudo make install
# 下载 Memcachedb 1.1
wget http://memcachedb.googlecode.com/files/memcachedb-1.1.0.tar.gz
# 解压 Memcachedb 1.1
tar -xvf memcachedb-1.1.0.tar.gz
# 进入目录
cd memcachedb-1.1.0
# 配置检测
./configure
# 编译(会有提示让你输入管理员密码)
sudo make
# 安装(会有提示让你输入管理员密码)
sudo make install
# 配置libdb-4.7.so库的访问路径(会有提示让你输入管理员密码)
sudo vi .bash_profile
# 加入以下一行,如果存在则修改该行,修改完成后[wq!]命令保存,
# 变量在重新登录后生效,如果需要马上使用,把这条命令在命令行执行一下就可以了。
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib:/usr/local/BerkeleyDB.4.7/lib
# 创建数据存储目录 ( 注意:日志需要定期清理)
mkdir /data0
# 运行MemcacheDB后台服务程序
memcachedb -d -p 21201 -u memcachedb -m 3096 -c 10240 -P /var/run/memcachedb.pid -N -H /data0/memcachedb -C 600 -t 8 -b 512
---------------------------------------------------------------------
memcachedb 1.1.0
---------------------------------------------------------------------
-p <num> TCP port number to listen on (default: 21201)
-U <num> UDP port number to listen on (default: 0, off)
-s <file> unix socket path to listen on (disables network support)
-a <mask> access mask for unix socket, in octal (default 0700)
-l <ip_addr> interface to listen on, default is INDRR_ANY
-d run as a daemon
-r maximize core file limit
-u <username> assume identity of <username> (only when run as root)
-c <num> max simultaneous connections, default is 1024
-b <num> item size smaller than <num> will use fast memory alloc, default is 512B
-v verbose (print errors/warnings while in event loop)
-vv very verbose (also print client commands/reponses)
-h print this help and exit
-i print license info
-P <file> save PID in <file>, only used with -d option
--------------------BerkeleyDB Options-------------------------------
-m <num> in-memmory cache size of BerkeleyDB in megabytes, default is 64MB
-A <num> underlying page size in bytes, default is 4096, (512B ~ 64KB, power-of-two)
-f <file> filename of database, default is 'data.db'
-H <dir> env home of database, default is '/data1/memcachedb'
-T <db_type> type of database, 'btree' or 'hash'. default is 'btree'
-L <num> log buffer size in kbytes, default is 32KB
-C <num> do checkpoint every <num> seconds, 0 for disable, default is 60s
-D <num> do deadlock detecting every <num> millisecond, 0 for disable, default is 100ms
-N enable DB_TXN_NOSYNC to gain big performance improved, default is off
--------------------Replication Options-------------------------------
-R identifies the host and port used by this site (required).
-O identifies another site participating in this replication group
-M/-S start as a master or slave
-----------------------------------------------------------------------