Make the cell configurable. Among other things we need this for is that you cannot migrate a tabled over when DB format changes, short of running 2 CLDs. We also add a few thoughts to the documentation, prompted by re-reading of the document while adding the clause for <Cell>. Signed-Off-By: Pete Zaitcev <zaitcev@xxxxxxxxxx> --- doc/etc.tabled.conf | 7 +++++++ doc/setup.txt | 40 +++++++++++++++++++++++++++++++++++++--- server/cldu.c | 4 ++++ server/config.c | 11 +++++++++++ server/server.c | 2 +- server/tabled.h | 1 + 6 files changed, 61 insertions(+), 4 deletions(-) commit 8c883a9b453b85d1da026f3638f074fe6d46df3f Author: Master <zaitcev@xxxxxxxxxxxxxxxxxx> Date: Thu Jan 14 19:37:59 2010 -0700 Add Cell configuration. diff --git a/doc/etc.tabled.conf b/doc/etc.tabled.conf index b3e6d68..f6c0bee 100644 --- a/doc/etc.tabled.conf +++ b/doc/etc.tabled.conf @@ -11,6 +11,13 @@ <Port>80</Port> </Listen> +<!-- + One cell per DB, don't skimp on cells. Also, make sure the replication + ports do not conflict when you make hosts to host several cells. + Unfortunately, the diagnostics are not very good if they do. + Most likely you'll see database corruption in such cases. + --> +<Cell>ultracart2</Cell> <TDB>/path/tabled/tdb</TDB> <TDBRepPort>8083</TDBRepPort> diff --git a/doc/setup.txt b/doc/setup.txt index 4338db4..0fd32da 100644 --- a/doc/setup.txt +++ b/doc/setup.txt @@ -10,13 +10,30 @@ _cld._udp.phx2.ex.com has SRV record 10 50 8081 pacman.phx2.ex.com. _cld._udp.phx2.ex.com has SRV record 10 50 8081 maika.phx2.ex.com. [root@table1 ~]# - If this does not work, set up CLD before proceeding. + If this does not work, STOP NOW. Then, talk to your DNS administrator. Also, make sure that your hostname has a domain. We don't want to search - for CLD in the DNS root, do we? + for CLD in the world-wide DNS root, do we? + + Make sure CLD is up (run "cldcli" to verify). + +*) Another thing to set up in DNS is a wildcard host for the system where + tabled will run. Unlike the SRV records of CLD, this is optional, but + these days applications may presume that it exists. Here's the way it's + done in ISC BIND: + +emus3 IN A 192.168.128.9 + IN TXT "Dell C8WQMC1" + IN AAAA fec0::1:219:b9ff:fe58:7ad6 +*.emus3 IN CNAME emus3 + + All examples on Google say FQDN is required, and most presume aliasing + of A and AAAA records, but BIND 9 eats the above fine. *) Copy configuration file from doc/etc.tabled.conf to /etc/tabled.conf - and edit to suit (see configurable items below). + and edit to suit (see configurable items below). Notice that the file + looks like XML, but is not really. In particular, names of elements are + case-sensitive. *) The tabled writes its pid to /var/run/tabled.pid by default. If you don't like the location, change it with <PID> tag. @@ -24,6 +41,17 @@ _cld._udp.phx2.ex.com has SRV record 10 50 8081 maika.phx2.ex.com. *) Create/choose TDB data directory, where Berkeley DB stores data and metadata. Change this location with <TDB> tag. +*) Assign the cell name: + + <Cell>ultracart3</Cell> + + Currently, a tabled process scans its cell, finds all other tabled + instances, and attempts to replicate its database to/from them. + In short, use one cell per business application. + + Cell name defaults to "default", so you can leave this element unset, + but don't do it. Any name, even "qwerty", is better than the default. + *) Select the port to listen, if desired. This is done using the <Listen> element: @@ -31,6 +59,12 @@ _cld._udp.phx2.ex.com has SRV record 10 50 8081 maika.phx2.ex.com. <Port>80</Port> </Listen> + Default is port 80, which you should use unless the system in question + hosts an unrelated webserver too. This is because some libraries, such + as ancient Google Boto, may have bugs that prevent them from talking to + ports other than 80 (for unencrypted HTTP). If your target clients are + bug-free, use anything you like. The 8080 is a popular choice. + *) Initialize TDB, the metadata database. Load user/password pairs into TDB, using tdbadm utility. The user/password pairs are presented to tdbadm stdin in the following text format: diff --git a/server/cldu.c b/server/cldu.c index d02eafd..273f149 100644 --- a/server/cldu.c +++ b/server/cldu.c @@ -129,6 +129,10 @@ static int cldu_nextactive(struct cld_session *sp) return sp->actx; } +/* + * Notice that for now we use the same cell name for both tabled and the + * chunkservers that it uses, so this function only takes one cell argument. + */ static int cldu_setcell(struct cld_session *sp, const char *thiscell, const char *thishost) { diff --git a/server/config.c b/server/config.c index 037176d..9d8ca87 100644 --- a/server/config.c +++ b/server/config.c @@ -317,6 +317,17 @@ static void cfg_elm_end (GMarkupParseContext *context, } #endif + else if (!strcmp(element_name, "Cell")) { + if (!cc->text) { + applog(LOG_WARNING, "Cell element empty"); + return; + } + + free(tabled_srv.cell); + tabled_srv.cell = cc->text; + cc->text = NULL; + } + else { applog(LOG_WARNING, "Unknown element \"%s\"", element_name); } diff --git a/server/server.c b/server/server.c index f16d2ab..6069534 100644 --- a/server/server.c +++ b/server/server.c @@ -1795,7 +1795,7 @@ int main (int argc, char *argv[]) if (rc) goto err_out_net; - if (cld_begin(tabled_srv.ourhost, NULL) != 0) { + if (cld_begin(tabled_srv.ourhost, tabled_srv.cell) != 0) { rc = 1; goto err_cld_session; } diff --git a/server/tabled.h b/server/tabled.h index a0d3400..60b6c05 100644 --- a/server/tabled.h +++ b/server/tabled.h @@ -236,6 +236,7 @@ struct server { char *chunk_user; /* username for stc_new */ char *chunk_key; /* key for stc_new */ unsigned short rep_port; /* db4 replication port */ + char *cell; /* our cell (both T and Ch) */ char *ourhost; /* use this if DB master */ struct database *db; /* database handle */ -- To unsubscribe from this list: send the line "unsubscribe hail-devel" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html