Harald Braumann wrote:
On Tue, 15 Apr 2008 16:08:21 -0700
Scott Baker <[EMAIL PROTECTED]> wrote:
I just had a major Berkelely DB data corruption that caused me all
kinds of headaches. I've had it with Berkeley DB it's old and
decrepit and I'm tired of dealing with it! It's 2008 and time for a
real backend. I'd really like to migrate my authreg and storage from
BDB to another backend. Preferably SQLite. Are there any scripts out
there that do this already? Any documentation about the format of the
data in the BDB files?
Yeah, wherever you see a berkeley db, convert it.
Now about the format (this is sm storage only):
The DB contains multiple sub DBs (active, queue, roster-items, etc.).
The key of each field is usually the collection-owner (i.e. JID). The
field content itself contains sub-fields (this format is jabberd2
specific): the first sub-field is a string, naming the field, the second
is an integer denoting the field type, and the third is the content
in an encoding specific to the field type. The sub-fields are delimited
by a 0 value.
Field types (from sm/sm.h):
typedef enum {
os_type_BOOLEAN, /**< boolean (0 or 1) */
os_type_INTEGER, /**< integer */
os_type_STRING, /**< string */
os_type_NAD, /**< XML */
os_type_UNKNOWN /**< unknown */
} os_type_t;
The content can only be an integer or a string (I think).
About authreg: I'm not really sure, but I think that there's a sub-DB
for each realm, and the key for each field is just the username, while
the value is the password.
Now you should be able to dump sm storage with the dumpdb.pl script.
The "unsupported hash version" error you mentioned in another mail is
usually caused by a wrong BDB version. I'm not sure, how RH does it,
but in Debian I have version specific BDB tools (like db4.2_dump). To
find out, which version is used by jabberd, just do
"ldd /usr/lib/jabberd/storage_db.so" (for your version you probably
have to do it on /usr/bin/sm) and you should get a line like
"libdb-4.2.so => /usr/lib/libdb-4.2.so (0xb7d25000)", so that would be
BDB 4.2. Then you can try the version specific dbx.x_dump tool.
dumpdb.pl should work equally well, however I don't know how to tell
the BerkeleyDB perl module which BDB version to use.
Another thing: when I had DB corruptions, db_recover usually didn't
work. db_dump and db_load did the trick.
Oh, and your jabberd version is stone old and not
supported any more.
For whatever reason Fedora still ships 2.0.0. Not sure why. I built 2.1.23
but with the GSASL bug still outstanding it's useless to try and run it:
http://jabberd2.xiaoka.com/ticket/200
As for dumping the DB, once I installed the right DB tools it's able to
"see" the data now, but doesn't give anything human readable...
VERSION=3
format=bytevalue
database=roster-items
type=hash
duplicates=1
db_pagesize=4096
HEADER=END
63726177666f726464406a61626265722e706572747572622e6f7267
61736b00010000000000000066726f6d000000000001000000746f0000000000010000006a696400020000006d6772656572406a61626265722e706572747572622e6f726700
63726177666f726464406a61626265722e706572747572622e6f7267
61736b00010000000000000066726f6d000000000001000000746f0000000000010000006a69640002000000666f72636569406a61626265722e706572747572622e6f726700
63726177666f726464406a61626265722e706572747572622e6f7267
61736b00010000000000000066726f6d000000000001000000746f0000000000010000006a696400020000007365616e73406a61626265722e706572747572622e6f726700
63726177666f726464406a61626265722e706572747572622e6f7267
61736b00010000000000000066726f6d000000000001000000746f0000000000010000006a6964000200000064616e77406a61626265722e706572747572622e6f726700
Etc... that's with db_dump... Is there some dumpdb.pl that I'm not aware
of. It's not in the tools or contrib section of 2.1.23.
--
Scott Baker - Canby Telcom
RHCE - System Administrator - 503.266.8253
--
To unsubscribe send a mail to [EMAIL PROTECTED]