[BlueOnyx:18559] Re: CODB dump

Michael Stauber mstauber at blueonyx.it
Thu Oct 22 20:29:06 -05 2015


Hi Ernie,

> Is there a command line program which can tell cced to dump out the entire
> CODB in a text format so I can examine it? Something like what the mysqldump
> command does for MySQL. I don't want to reimport the dump, just curious as
> to what's in there.

One way is to use cmuExport with the "-c" switch. That only generates
the XML files without the tarballs that contain the websites, users and
emails. The resulting cmu.xml is a pretty complete dump of CODB and all
its data.

Other than that: Just to poke a little around I really recommend cceclient:

[root at 5209r root]# /usr/sausalito/bin/cceclient
100 CSCP/0.99
200 READY
help
ADMIN suspend | resume : suspend or resume write operations
AUTH <username> <passwd> : Authenticate as a user
AUTHKEY <username> <sessionid> : Attempt to resume a session
BEGIN : Begin a transaction
BYE [SUCCESS | FAIL | DEFER] : Disconnect immediately, indicating exit
status
CLASSES : List all classes
CREATE <class> [<key>=<value> ...] : Create a new instance of the
specified class
DESTROY <oid> : Destroy the specified object
ENDKEY : Expire the current sessionid now
FIND <class> [<key>=<value> ...] : Find instances of the specified
class, matching given criteria
GET <oid>[.<namespace>] : Get a list of key=value pairs for the
specified object
HELP : Show help about all commands currently available
NAMES <oid> | <class> : List available namespaces for an object or class
SET <oid>[.<namespace>] [<key>=<value> ...] : Set all listed keys to
listed values in the specified object
WHOAMI : Get the object id of the currently logged in user

When you run "help" (as shown above) it tells you the available command.

With "CLASSES" you can see what classes are there. With "NAMES <OID>"
you can see what namespaces an object has.

Example:

find Vsite name = site1
104 OBJECT 114
201 OK
names 114
105 NAMESPACE SSL
105 NAMESPACE UserDefaults
105 NAMESPACE FTPNONADMIN
105 NAMESPACE SiteStats
105 NAMESPACE Shell
105 NAMESPACE AnonFtp
105 NAMESPACE subdomains
105 NAMESPACE CGI
105 NAMESPACE DNS
105 NAMESPACE Compass_webapps
105 NAMESPACE roundcubemail
105 NAMESPACE PHP
105 NAMESPACE PHPVsite
105 NAMESPACE USERWEBS
105 NAMESPACE Disk
105 NAMESPACE MYSQL_Vsite
105 NAMESPACE SSI
105 NAMESPACE Java
201 OK

So you can see that a "Vsite" object has the above namespaces. Which you
can examine via the GET command:

get 114 		<-- To look at the Vsite object
get 114 . PHPVsite	<-- PHP settings of this Vsite

I do ally my "poking around" with cceclient, as it can do everything the
GUI can do (and more). When you start cceclient as "root" you don't need
to authenticate against it to get "admin" privileges. If you access it
as unprivileged users, then the ACL's prevent you from seeing (or doing)
much until you have authenticated via "AUTH admin password".

As for any other export method:

About two years ago I started on something that (sadly) has remained a
dirty hack. But it has potential and certain usage cases.

Imagine the CODB directory is shot in a way that CCE and/or cceclient
can't access the data anymore. Because of index corruption or therelike.

I do have a PHP script that indexes /usr/sausalito/codb/ and from all
files within it generates a hashtable that contains the data of *all*
objects.

I then take what I usually need in such cases (the Vsite objects and
User objects) and let the PHP script generate two Perl scripts that have
all the CREATE and SET transactions in them to re-create the Vsites and
Users (with all their settings) on a fresh server.

That has helped me with restoring a few boxes where CODB was shot to
pieces that even a cmuExport wouldn't have worked anymore.

I could easily export the hashtable into a different format such as XML.
But then again: That would replicate what cmuExport does with the cmu.xml.

-- 
With best regards

Michael Stauber



More information about the Blueonyx mailing list