Return-Path: Delivered-To: apmail-cassandra-dev-archive@www.apache.org Received: (qmail 72028 invoked from network); 30 Jul 2010 17:02:04 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 30 Jul 2010 17:02:04 -0000 Received: (qmail 51230 invoked by uid 500); 30 Jul 2010 17:02:03 -0000 Delivered-To: apmail-cassandra-dev-archive@cassandra.apache.org Received: (qmail 51172 invoked by uid 500); 30 Jul 2010 17:02:03 -0000 Mailing-List: contact dev-help@cassandra.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cassandra.apache.org Delivered-To: mailing list dev@cassandra.apache.org Received: (qmail 51164 invoked by uid 99); 30 Jul 2010 17:02:03 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 30 Jul 2010 17:02:03 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: local policy) Received: from [150.140.141.169] (HELO poseidon.ceid.upatras.gr) (150.140.141.169) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 30 Jul 2010 17:01:56 +0000 Received: from mail.ceid.upatras.gr (unknown [10.1.0.143]) by poseidon.ceid.upatras.gr (Postfix) with ESMTP id 2678AEB484B for ; Fri, 30 Jul 2010 20:01:33 +0300 (EEST) Received: from localhost (europa.ceid.upatras.gr [127.0.0.1]) by mail.ceid.upatras.gr (Postfix) with ESMTP id 3613A16013A for ; Fri, 30 Jul 2010 20:01:33 +0300 (EEST) X-Virus-Scanned: amavisd-new at ceid.upatras.gr Received: from mail.ceid.upatras.gr ([127.0.0.1]) by localhost (europa.ceid.upatras.gr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id vJGw0etO6ekG for ; Fri, 30 Jul 2010 20:01:33 +0300 (EEST) Received: by mail.ceid.upatras.gr (Postfix, from userid 48) id EDFE816014A; Fri, 30 Jul 2010 20:01:32 +0300 (EEST) Received: from 94.64.192.47 by webmail.ceid.upatras.gr with HTTP; Fri, 30 Jul 2010 20:01:32 +0300 (EEST) Message-ID: <36256.94.64.192.47.1280509292.squirrel@webmail.ceid.upatras.gr> Date: Fri, 30 Jul 2010 20:01:32 +0300 (EEST) Subject: Re: Creating two instances in code From: altanis@ceid.upatras.gr To: dev@cassandra.apache.org User-Agent: SquirrelMail/1.4.8-5.el5_3.7 MIME-Version: 1.0 Content-Type: text/plain;charset=utf-8 Content-Transfer-Encoding: 8bit X-Priority: 3 (Normal) Importance: Normal Thank you for your answer. I know I should change the code. My question was mainly on how to change the code to do this. For example, will making DatabaseDescriptor a non-static class be enough? I could have Cassandra build a DatabaseDescriptor instance at startup, which could be a class variable of some basic class, and then replace all instances of DatabaseDescriptor.someFunction() with method calls on the object. Will that be enough or are there many more singletons in the code? Any different suggestions? Alexander Altanis > The resource file (cassandra.yaml) is statically defined that is > brought in from the classpath. To do what you desire will require > changing the code. > > You could modify DatabaseDescriptor.getStorageConfigPath() to accept > some kind of variable to indicate the instance and then load a > different file. > > But that's the least of your problems, as you're probably noticing. > The heavy use of singletons will prevent you from isolating some of > the services, and the fact that DatabaseDescriptor loads its > configuration in a static block into static members will be very > problematic. > > Gary. > > On Thu, Jul 29, 2010 at 11:36, wrote: > > Hello, > > > > I'd like to make some changes to cassandra so that when starting up a node > > in a cluster, another node starts in another cluster. That requires that > > the two nodes have different configurations, but DatabaseDescriptor (where > > I think all the config reading is done) seems to load everything > > statically when the class is loaded. The configuration path seems to > > reside in System.getProperties(). Can you suggest a way for me to build a > > second node with a different configuration path in the same code? > > > > Unfortunately, I cannot simply launch two different cassandra instances on > > the same computer, as I want the second node to have access to information > > from the first node, such as node load for the first cluster and such > > (plus even running two separate cassandra instances on the same node seems > > to require workarounds and hacks). > > > > Alexander Altanis > >