memcacheDB設置
PylonsもRails同様、開発環境・テスト環境・本番環境を分けることができる。今回は、
を動かすことにする。Gentooの場合この設定は簡単で、/etc/init.d/memcachedbのシンボリックリンクを作成し、
# cd /etc/init.d # ln -s memcachedb memcachedb2
/etc/conf.d/memcachedb2 にポートおよびDB実体のディレクトリを定義。
# cd /etc/conf.d # cp memcachedb memcachedb2
/etc/conf.d/memcachedb2の内容は以下の通り。
# Copyright 2009 Gentoo Technologies, Inc # $Header: $ # memcachedb config file MEMCACHEDB_BINARY="/usr/bin/memcachedb" #in-memmory cache size of BerkeleyDB in megabytes, default is 64MB #64MB is default BDB_CACHE_SIZE="64" #underlying page size in bytes, default is 4096, (512B ~ 64KB, power-of-two) PAGE_SIZE="16384" #User to run as MEMCACHEDB_RUNAS="memcachedb" #Specify maximum number of concurrent connections #1024 is default MAXCONN="1024" #Listen for connections on what address? # If this is empty, memcachedb will listen on 0.0.0.0 # be sure you have a firewall in place! LISTENON="" #Listen for connections on what port? PORT="31201" #do checkpoint every <num> seconds, 0 for disable, default is 5 minutes CHECKPOINT_PERIOD="300" #PID file location # '-${PORT}.${CONF}.pid' will be appended to this! # You do not normally need to change this. PIDBASE="/var/run/memcachedb/memcachedb" #DB file location # 'memcachedb-${CONF}.db' will be appended to this! # Make sure that different instances have different DB folders DBBASE="/var/spool/memcachedb2/default/" #Other Options #refer to "memcachedb -h" for replication options MISC_OPTS=""
これでmemcachedbおよびmemcachedb2を起動すれば、二つのインスタンスが立ち上がる。
# /etc/init.d/memcachedb start # /etc/init.d/memcachedb2 start