harumaki.net

インフラ屋の覚書や、ラーメン食べある記とか。

CentOS DB FireBird メモ 作業ログ

[DB]FireBirdをインストールしてみた(RPM編)

投稿日:2012年8月1日

Last Updated on 2021年7月4日 by かんりにん

[pukiwiki]

FireBird2.5をVPSを利用して、CentOS6環境でささっといじってみました。
epelリポジトリで提供されているパッケージを使えたので、セットアップは楽でした
(yum を最初に利用する際にGPGキーをインポートする必要あり)。
アーキテクチャごとにパッケージが分かれているので、必要に応じてインストールしてあげる形です。

-参考:大変お世話になったサイトです!

–公式サイト
http://www.firebirdsql.org/

–Firebird 2.5 Quick Start Guide
http://www.firebirdsql.org/file/documentation/reference_manuals/user_manuals/html/qsg25.html

–reference manuals
http://www.firebirdsql.org/en/reference-manuals/

–FireBird日本ユーザー会
http://tech.firebird.gr.jp/firebird/index.php?firebird_xsite=0

–Firebird wiki
インストール、初期設定、解説など。
http://firebirdwiki.jp/index.php

**アーキテクチャについてメモ

まったくど素人なので、まず3種類から選べるアーキテクチャから見てみました。

+”classic”
— パッケージの場合、スーパーサーバー(xinetd)でデーモンが動く
— マルチセッション対応
+”superserver”
— 単独でデーモンが動く
— キャッシュを全コネクションでシェアする
— ネットワークレイヤでのアクセスを受け付ける
+”superclassic”
— もともとあったclassic、superserverの合いの子?一番新しいアーキテクチャ。
— 単独でデーモンが動く。
— classicアーキテクチャと、いくつかのライブラリを共有する

とのことでしたが、ど素人なのでよくわかりませんw
superserverがxinetd管理下でなく単独で動作するとかややこしい部分もありましたが、歴史的な経緯なんだろなと…。

***アーキテクチャについて、パッケージインストール時にわかったこと

-classicを使用する場合、xinetdの環境が必要
xinetdが入っていない場合、yum install時に追加されます。
-アーキテクチャを指定しないでfirebirdのベースパッケージのみを指定すると、superclassicが選択された(推奨パッケージということかな?)。
-パッケージの場合、3種類のアーキテクチャがそれぞれコンフリクトしてしまうので、同時にインストールすることはできない。
–classicとsuperclassicは、本体がそれぞれ競合
※両方ともclassic-commonパッケージを利用するのでコンフリクトしないかとおもったがダメでした。
–classicとsuperserverの場合、classic-commonパッケージとsuperserverが競合
–superclassicとsuperserverの場合も同じく、classic-commonパッケージとsuperserverが競合
→詳しくは後述します。
ソースの場合も、ビルドする際にどれかを選ぶ必要があるのかも。

***パッケージ確認

# yum search firebird
Loaded plugins: fastestmirror, security
Loading mirror speeds from cached hostfile
* base: ftp.nara.wide.ad.jp
* epel: ftp.iij.ad.jp
* extras: ftp.nara.wide.ad.jp
* updates: ftp.nara.wide.ad.jp
======================================= N/S Matched: firebird ==============================================
firebird-classic.x86_64 : Classic (xinetd) server for Firebird SQL RDBMS
firebird-classic-common.x86_64 : Common files for Firebird “classic” and “superclassic” servers
firebird-devel.i686 : Development Libraries for Firebird SQL RDBMS
firebird-devel.x86_64 : Development Libraries for Firebird SQL RDBMS
firebird-doc.x86_64 : Documentation for Firebird SQL RDBMS
firebird-filesystem.x86_64 : Filesystem for Firebird SQL RDBMS
firebird-libfbclient.i686 : Multi-threaded, non-local client libraries for Firebird SQL RDBMS
firebird-libfbclient.x86_64 : Multi-threaded, non-local client libraries for Firebird SQL RDBMS
firebird-libfbembed.i686 : Multi-process, local client libraries for Firebird SQL RDBMS
firebird-libfbembed.x86_64 : Multi-process, local client libraries for Firebird SQL RDBMS
firebird-superclassic.x86_64 : SuperClassic (single process) server for Firebird SQL RDBMS
firebird-superserver.x86_64 : Superserver (single process) server for Firebird SQL RDBMS
mono-data-firebird.x86_64 : Firebird database connectivity for Mono
firebird.x86_64 : SQL relational database management system
php-ZendFramework-Db-Adapter-Firebird.noarch : Zend Framework database adapter for InterBase
php-interbase.x86_64 : Standard PHP module provides interbase/firebird support
python-kinterbasdb.x86_64 : A Python DB-API 2.0 compliant interface to Firebird

Name and summary matches only, use “search all” for everything.

**インストール(superclassic)

マネージメントシステムである”firebird.x86_64″をインストール対象にすると
アーキテクチャは依存関係パッケージにてfirebird-superclassicが追加されます。

# yum install firebird

Dependencies Resolved

============================================================================================================
Package Arch Version Repository Size
============================================================================================================
Installing:
firebird x86_64 2.5.1.26351.0-1.el6 epel 659 k
Installing for dependencies:
firebird-classic-common x86_64 2.5.1.26351.0-1.el6 epel 999 k
firebird-filesystem x86_64 2.5.1.26351.0-1.el6 epel 8.9 k
firebird-libfbclient x86_64 2.5.1.26351.0-1.el6 epel 290 k
firebird-libfbembed x86_64 2.5.1.26351.0-1.el6 epel 1.6 M
firebird-superclassic x86_64 2.5.1.26351.0-1.el6 epel 168 k
libicu x86_64 4.2.1-9.1.el6_2 base 4.9 M

Transaction Summary
============================================================================================================
Install 7 Package(s)

Total download size: 8.6 M
Installed size: 32 M
Is this ok [y/N]: N

ひとまず上記パッケージにdevelを追加する形でインストールしてみることにします。

# yum install firebird \
> firebird-devel \
> firebird-classic-common \
> firebird-filesystem \
> firebird-libfbclient \
> firebird-libfbembed \
> firebird-superclassic \
> libicu

**設定ファイル構成

RPM版で入れる分には、ほかのRPMパッケージ同様のファイル配置になるので
パッケージ管理に慣れていれば、特に迷うことはなさそうです。

–設定ファイル
/etc/firebird

—ファイル構成
# ll /etc/firebird/
total 48
-rw-rw-r– 1 firebird firebird 247 Feb 3 2012 aliases.conf
-rw-rw-r– 1 firebird firebird 6381 Feb 3 2012 fbintl.conf
-rw-rw-r– 1 firebird firebird 4914 Feb 3 2012 fbtrace.conf
-rw-rw-r– 1 firebird firebird 26723 Feb 3 2012 firebird.conf

–ログローテート設定ファイル
/etc/logrotate.d/firebird

–データ領域
データ領域はRPM版のmysql、postgreSQL同様、/var/lib以下に展開されていました。
拡張子.fdbがいわゆるデータファイル(表領域?)です。
# ls -altR /var/lib/firebird/
/var/lib/firebird/:
total 16
drwxr-xr-x 2 root root 4096 Aug 15 14:22 system
drwxr-xr-x 2 firebird firebird 4096 Aug 15 14:22 data
drwxr-xr-x 4 root root 4096 Aug 15 14:22 .
drwxr-xr-x. 23 root root 4096 Aug 15 14:22 ..

/var/lib/firebird/system:
total 1968
drwxr-xr-x 2 root root 4096 Aug 15 14:22 .
drwxr-xr-x 4 root root 4096 Aug 15 14:22 ..
-rw-r–r– 1 root root 159348 Feb 3 2012 de_DE.msg
-rw-r–r– 1 root root 148556 Feb 3 2012 firebird.msg
-rw-r–r– 1 root root 159920 Feb 3 2012 fr_FR.msg
-rw-r–r– 1 root root 811008 Feb 3 2012 help.fdb
-rw——- 1 firebird firebird 720896 Feb 3 2012 security2.fdb

/var/lib/firebird/data:
total 1088
drwxr-xr-x 2 firebird firebird 4096 Aug 15 14:22 .
drwxr-xr-x 4 root root 4096 Aug 15 14:22 ..
-rw-rw—- 1 firebird firebird 1105920 Feb 3 2012 employee.fdb

–ログファイル出力先
/var/log/firebird/以下

**おまけ:ほかのアーキテクチャをインストールする場合

→結論から言うと、3種類あるアーキテクチャのうち2種類、あるいは3種すべてを
同時にインストールしたり、用途に応じて使い分けたり、といったことは出来ない様子です
※インストール時に–nodepsで入れた場合はわかりませんが、sandboxで試す感じですね。

FireBirdに用意されているアーキテクチャは3種類、firebirdのRPM版の場合はデフォルトでは依存関係によりsuperclassicがインストールされますが
後からclassic、superserverを追加でインストールしようとするとコンフリクトが発生してしまいました。

– firebird-classicの場合
# yum install firebird-classic

— 中略 —

–> Processing Conflict: firebird-superclassic-2.5.1.26351.0-1.el6.x86_64 conflicts firebird-classic
–> Processing Conflict: firebird-classic-2.5.1.26351.0-1.el6.x86_64 conflicts firebird-superclassic
–> Finished Dependency Resolution
Error: firebird-superclassic conflicts with firebird-classic
Error: firebird-classic conflicts with firebird-superclassic
You could try using –skip-broken to work around the problem
You could try running: rpm -Va –nofiles –nodigest
#

– firebird-superserverの場合
# yum install firebird-superserver

— 中略 —

–> Processing Conflict: firebird-classic-common-2.5.1.26351.0-1.el6.x86_64 conflicts firebird-superserver
–> Processing Conflict: firebird-superserver-2.5.1.26351.0-1.el6.x86_64 conflicts firebird-classic-common
–> Finished Dependency Resolution
Error: firebird-classic-common conflicts with firebird-superserver
Error: firebird-superserver conflicts with firebird-classic-common
You could try using –skip-broken to work around the problem
You could try running: rpm -Va –nofiles –nodigest
#

yumインストール時に”–skip-broken”を使うか、いったんダウンロードしてrpmコマンドで
個別にインストールする、などの対応になるかと思います。

***参考1 classicの場合のファイル構成

# yum install firebird-classic
— snip —
=================================================================
Package Arch
=================================================================
Installing:
firebird-classic x86_64
Installing for dependencies:
firebird x86_64
firebird-classic-common x86_64
firebird-filesystem x86_64
firebird-libfbclient x86_64
firebird-libfbembed x86_64
libicu x86_64

Transaction Summary
=================================================================
Install 6 Package(s)

Total download size: 8.4 M
Installed size: 32 M

***参考2 superserverの場合のファイル構成

# yum install firebird-superserver
— snip —
=================================================================
Package Arch
=================================================================
Installing:
firebird-superserver x86_64
Installing for dependencies:
firebird x86_64
firebird-filesystem x86_64
firebird-libfbclient x86_64
firebird-libfbembed x86_64
libicu x86_64

Transaction Summary
=================================================================
Install 6 Package(s)

Total download size: 10 M
Installed size: 37 M

superserverは”firebird-classic-common”パッケージがインストールされないので
パッケージ数が減るが、firebird-superserver が2MB以上あり、トータルではインストールサイズがもっとも大きいですね。

**プロセス(インスタンス)の起動/停止

アーキテクチャ別の運用方法を。

***1. classic

classicはxinetd(スーパーサーバー)の起動でアクセスできるようになるので
/etc/xinetd.d/以下の”firebird”ファイルを編集して有効にします。
この辺はtelnetやvsftpdなどと同じなので、特筆事項はありませんが、念のためまとめました。

– /etc/xinetd.d/firebird
disble = yesに変更すればOK。
{
disable = no
flags = REUSE
socket_type = stream
wait = no
user = firebird
# These lines cause problems with Windows XP SP2 clients
# using default firewall configuration (SF#1065511)
# log_on_success += USERID
# log_on_failure += USERID
server = /usr/sbin/fb_inet_server
}
コメントアウトされていますが、Windows XP SP2のファイアウォールの設定に対応したユーザー設定パラメータもある様子(要調査ですが、さすがにSP2はもういいのでは…)

設定変更後、xinetdを起動すればOKです。

***2. superclassic

– 起動/停止スクリプト(init)
initスクリプトはDBアーキテクチャごとに用意されるようで、今回は
sperclassicのinitスクリプトがインストールされていました。

-スクリプト:/etc/init.d/firebird-superclassic
# ll /etc/init.d/firebird-superclassic
-rwxr-xr-x 1 root root 2493 Feb 3 2012 /etc/init.d/firebird-superclassic

-コマンドからの起動/停止
— 起動
# /etc/init.d/firebird-superclassic start
Starting Firebird server [default] [ OK ]
または
# service firebird-superclassic start
–起動時、”/var/log/firebird/firebird.log”に出力されるログを抜粋
hogehoge.localhost (Client) Tue Jul 1 17:43:20 2012
/usr/sbin/fbguard: guardian starting /usr/sbin/fb_smp_server
– 停止
# /etc/init.d/firebird-superclassic stop
または
# service firebird-superclassic stop
ただしデフォルトでは自動起動はONになっていないので、ここは適宜変更してあげるかたちで。

– ランレベル確認
# chkconfig –list | grep firebird
firebird-superclassic 0:off 1:off 2:off 3:off 4:off 5:off 6:off
– ランレベル設定
# chkconfig firebird-superclassic on
または
# chkconfig –level 2345 firebird-superclassic
– 設定後のランレベル確認
# chkconfig –list | grep firebird
firebird-superclassic 0:off 1:off 2:on 3:on 4:on 5:on 6:off

***3. superserver

– 起動
# /etc/init.d/firebird-superserver start
Starting Firebird server [default] [ OK ]
または
# service firebird-superserver start
–起動時、”/var/log/firebird/firebird.log”に出力されるログを抜粋
hogehoge.localhost (Client) Tue Jul 1 18:33:19 2012
/usr/sbin/fbguard: guardian starting /usr/sbin/fbserver
※こちらの起動プロセスはfb_smp_serverでなく”fbserver”となっています。

– プロセスはこんな感じ
# ps -aef | grep firebird
firebird 23819 1 0 18:33 ? 00:00:00 /usr/sbin/fbguard -pidfile /var/run/firebird/default.pid -daemon -forever
firebird 23820 23819 0 18:33 ? 00:00:00 /usr/sbin/fbserver
root 23832 1369 0 18:34 pts/0 00:00:00 grep firebird

– TCPポート3050番を使って待機してます
–netstat
# netstat -ln | grep 3050
tcp 0 0 0.0.0.0:3050 0.0.0.0:* LISTEN
–lsof
# lsof -i:3050
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
fbserver 23820 firebird 0u IPv4 28444 0t0 TCP *:gds_db (LISTEN)

– 停止
# /etc/init.d/firebird-superserver stop
Stopping Firebird server [default]: [ OK ]
または
# service firebird-superserver stop

こちらもfirebird-superclassic同様デフォルトでは自動起動はONになっていないので
ここは適宜変更してあげるかたちで。chkconfigの設定をすればよいので設定方法は省きます。

– ランレベル確認
# chkconfig –list | grep firebird
firebird-superserver 0:off 1:off 2:off 3:off 4:off 5:off 6:off

[/pukiwiki]
 

-CentOS, DB, FireBird, メモ, 作業ログ
-,

執筆者:


comment

メールアドレスが公開されることはありません。 が付いている欄は必須項目です

CAPTCHA


関連記事

[PHP] RedHat/CentOSのcurlで”SSL Connection Errorが発生しちゃった件

モバイルサイトのキャリア通信にて、ユーザー認証の部分でcurlを使っているが アプリサーバーのOSをCentOS5から6へ上げて検証していたところ、開発チームから“SSL Connecti …

[MySQL]mysqlのGRANT情報を抜粋するシェルスクリプト

  ただの道具。 DBサーバーの現状調査用に。 mysql_grant_export.sh #!/bin/bash mysql -uroot -p<パスワードを入れる> -e " …

no image

AWstatsのインストール(RPM版)

[pukiwiki] アクセスログ解析ツールawstatのインストールのメモ。 Software Design2006年1月号を参照。 今回はローカル上で運用しているバーチャルホストのログを解析。 ※ …

[DIY]Filco Majestouch のキーキャップを交換してみた 前編 (取り外し編!)

先日職場で移動に伴う席替えをした際、行方不明だった備品のFilcoのMajestouch(型番FKBN91MC-NFB2・青軸・テンキーレス)が出土してきましたwww なかなかに閲覧注意(大汗) 見る …

[DIY]Filco Majestouch のキーキャップを交換してみた 後編 (掃除・取り付け編!)

  [パソコンDIY]Filco Majestouch のキーキャップ交換と掃除 1 (取り外し編!)はこちら   Magestouchのキーキャップ交換とお掃除の続きです。前回キーキャップを一通り取 …