debファイル作成
■■■debファイル作成■■■
今回は例としてhttpd-2.2.16.tar.gzを使用する
■ビルド準備
/deb ディレクトリを作成
/deb/httpd-2.2.16 ディレクトリを作成
そこにsourceファイルを保存。
tar zxf httpd-2.2.16.tar.gz
mv httpd-2.2.16 custom-httpd-2.2.16 <- パッケージに付けたい名前にする
cd custom-httpd-2.2.16
dh_makeコマンドでconfigureオプションやスクリプトを書くテンプレートファイルを作成
dh_make -e sakamoto_yoshihisa@cyberagent.co.jp -f ../httpd-2.2.16.tar.gz
-e :パッケージ管理者のメールアドレスを指定
-f :パッケージを指定
カレントディレクトリにdebianディレクトリが作成される
以下にはテンプレートファイルが作成される。
rules :configureオプションなどを記載
control :Description、Dependsなどを記載
copyright :管理者情報やライセンスなどを記載
postinst.ex :インストールしたあとに実行するシェル
preinst.ex :インストールする前に実行するシェル
postrm.ex :アンインストールしたあとに実行するシェル
prerm.ex :アンインストールする前に実行するシェル
上記ファイルを適宜編集
■ビルド
cd /deb/httpd-2.2.16/custom-httpd-2.2.16
dpkg-buildpackage -rfakeroot
正常終了すると/deb/httpd-2.2.16以下に
custom-httpd_2.2.16-1_amd64.deb
のファイルが作成される
■リポジトリへ登録
公開リポジトリの適当な場所に保存して
パッケージ情報を作成する。
ドキュメントルートにて以下を実行
apt-ftparchive packages . > Packages
gzip Packages
■インストール
/etc/apt/sources.listに以下などのように記載
deb http://hostname.com/xxxx/ lucid custom
aptitude update
aptitude search custom-httpd
パッケージ名とDescriptionで記載した内容が表示される。
aptitude install custom-httpd
でインストールできることを確認
■rulesファイルのサンプル
#!/usr/bin/make -f
# -*- makefile -*-
# Sample debian/rules that uses debhelper.
# This file was originally written by Joey Hess and Craig Small.
# As a special exception, when this file is copied by dh-make into a
# dh-make output file, you may use that output file without restriction.
# This special exception was added by Craig Small in version 0.37 of dh-make.
# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1
# These are used for cross-compiling and for saving the configure script
# from having to guess our platform (since we know it already)
DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
config.status: configure
dh_testdir
# Add here commands to configure the package.
ifneq "$(wildcard /usr/share/misc/config.sub)" ""
cp -f /usr/share/misc/config.sub config.sub
endif
ifneq "$(wildcard /usr/share/misc/config.guess)" ""
cp -f /usr/share/misc/config.guess config.guess
endif
CFLAGS=" -O2 -m64 -DLOG_BUFSIZE=65500"
export CFLAGS
./configure \
--prefix=/usr/local/apache \
--with-mpm=worker \
--with-included-apr \
--enable-headers \
--enable-rewrite \
--enable-proxy \
--enable-usertrack \
--enable-proxy-ajp \
--enable-so \
--disable-include \
--disable-autoindex \
--disable-asis \
--disable-cgi \
--disable-negotiation \
--disable-actions \
--disable-userdir
build: build-stamp
build-stamp: config.status
dh_testdir
# Add here commands to compile the package.
$(MAKE)
#/usr/bin/docbook-to-man debian/numru-misc.sgml > numru-misc.1
touch $@
clean:
dh_testdir
dh_testroot
rm -f build-stamp
# Add here commands to clean up after the build process.
-$(MAKE) distclean
rm -f config.sub config.guess
dh_clean
install: build
dh_testdir
dh_testroot
dh_clean -k
dh_installdirs
# Add here commands to install the package into debian/numru-misc.
$(MAKE) prefix=$(CURDIR)/debian/tmp/usr/local/apache install
# Build architecture-independent files here.
binary-indep: build install
# We have nothing to do by default.
# Build architecture-dependent files here.
binary-arch: build install
dh_testroot
dh_prep
dh_installdirs
dh_auto_install
dh_install
dh_installdocs
dh_installchangelogs
dh_installexamples
dh_installman
dh_installcatalogs
dh_installcron
dh_installdebconf
dh_installemacsen
dh_installifupdown
dh_installinfo
dh_pysupport
dh_installinit
dh_installmenu
dh_installmime
dh_installmodules
dh_installlogcheck
dh_installlogrotate
dh_installpam
dh_installppp
dh_installudev
dh_installwm
dh_installxfonts
dh_bugfiles
dh_lintian
dh_gconf
dh_icons
dh_perl
# dh_usrlocal
dh_link
dh_compress
dh_fixperms
dh_strip
dh_makeshlibs
# dh_shlibdeps
dh_installdeb
dh_gencontrol
dh_md5sums
dh_builddeb
binary: binary-indep binary-arch
.PHONY: build clean binary-indep binary-arch binary install
mysqlslap
mysqlでベンチマークが必要になった。
いままでsuper-smackを使用していたが、
シナリオを作成したり面倒で、且つ、HW性能を確認したいのが目的だったため、
他のものを探した。
どのDB、どのHWで実施しても同じテストができ、
その結果をずっと持っておきたかったのでmysqlslapを使用することにした。
■mysqlslapとは
mysql 5.1.4から提供されているもので
詳しいシナリオを書かずともクライアントアクセスをエミュレートしてくれる。
どの別でDBを作成しそこでcreateやupdate、selectなどを実施するので
いつ、どこでやっても、HW、mysql自体のチューニングが比較ができる。と思う。。
■インストールとセットアップ
http://dev.mysql.com/downloads/mysql/5.1.html#downloads
上記サイトから
MySQL-client-5.1.49-1.glibc23.x86_64.rpm
をダウンロードしてインストール
※テストをしたいサーバとは別にテストをかける側を用意した方が
負荷かける側の影響がでなくてよい
hostを指定するため/etc/hosts にテストをしたいサーバのIPを記載
テストをしたいサーバ上で以下のようにユーザを作成
■実施
/usr/bin/mysqlslap --auto-generate-sql --auto-generate-sql-guid-primary --engine=innodb --number-int-cols=10 --number-char-cols=10 --concurrency=20 --auto-generate-sql-write-number=10000 --auto-generate-sql-execute-number=10000 --auto-generate-sql-load-type=mixed --port=13306 --host=xxx --user=root --password
--concurrency クライアント数
--number-char-cols CHAR型カラムの作成数
--number-int-cols INT型カラムの作成数
--auto-generate-sql SQLステートメントの自動生成
--auto-generate-sql-guid-primary GUIDベースのプライマリキー・カラムを作成
--auto-generate-sql-write-number テーブルに格納するデータ数
--auto-generate-sql-execute-numbe クライアントごとのクエリー数
--auto-generate-sql-load-type アクセスパターン
アクセスパターン 内容
Write Insertステートメントによる書き込み
Key Selectステートメントによる主キーを使用した検索
Update Updateステートメントによる更新
Mixed WriteとKeyを実施
その他詳しいパラメータについては以下を参照
http://dev.mysql.com/doc/refman/5.1/ja/mysqlslap.html
mod_wsgi
mod_pythonが開発終了とのことなのでmod_wsgiを設定
mod_wsgi-3.2.tar.gzをDL
tar xzf mod_wsgi-3.2.tar.gz
cd mod_wsgi-3.2
./configure --with-apxs=/usr/local/apache/bin/apxs --with-python=/usr/local/bin/python2.5
make
make install
前回のmod_pythonまでを設定
httpd.confに以下を追加
LoadModule wsgi_module modules/mod_wsgi.so
<Directory /usr/local/apache/xxxx>
Order deny,allow
Allow from all
</Directory>
<Directory /usr/local/apache/htdocs/xxx >
Order deny,allow
Allow from all
</Directory>
WSGIPythonEggs /usr/local/apache/htdocs/
wsgiファイルを作成
cat << EOF > /usr/local/apache/htdocs/xxx/application.wsgi
import os
import sys
sys.path.append('/usr/local/apache/xxxx')
os.environ['DJANGO_SETTINGS_MODULE'] = 'xxxx'
import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()
EOF
apache再起動