Samba in an HA environment

Nicolas Williams Nicolas.Williams at ubsw.com
Tue May 23 14:42:21 GMT 2000


You should start each instance of nmbd/smbd with the environment
variable 'HA_PERSONALITY' set to some string, as long as it's not the
same string for both. The %$() syntax in smb.conf expands the variable
named between the parentheses to its value in the environment.

So $%(PATH) would expand to /usr/bin:/usr/sbin:/sbin (or whatever PATH
is set to in your environment) and so on.

So, when you say 'source environment = /etc/smb.conf.env.%$(HA_PERSONALITY)'
what you mean is that the file named /etc/smb.conf.env.homedir (if
HA_PERSONALITY == 'homedir') should be sourced.

That file might contain something like:

SMB_NETBIOS_NAME=somename
SMB_SHARE_DEFS=/etc/smb.conf.homeshares
...

and the next lines after 'source environment' in your smb.conf might be:

	netbios name = %($SMB_NETBIOS_NAME)
	include      = %($SMB_SHARE_DEFS)

And so on.

As for nmbd/smbd binding to 127.0.0.1, I don't configure them to do so
(see 'interfaces'). I think that may break SWAT, but since I don't use
SWAT it doesn't matter [to me].

The point is, you can have two instances of nmbd/smbd running on the
same host, provided they bind to different IP addresses. If you make
intelligent use of %$() and 'source environment' then your start/stop
scripts can be trivial since all they have to do before starting either
instance of nmbd/smbd is set and export HA_PERSONALITY to the
environment.

Nico


On Tue, May 23, 2000 at 12:44:58PM +0200, Larsson, Johan wrote:
> Thanks. I haven't tried running two instances of nmbd/smbd, since I thought
> both nmbd would try to bind to localhost:138, and thus cause one to fail. I
> am about to try this now.
> 
> I am obviously a bit of a blockhead, since I can't figure out what use I
> have of custom environment variables from within the samba config file... Is
> the trick related to %$(ENV) which I haven't seen before?
> 
> Thanks again for your help,
> 
> Johan 
> 
> -----Original Message-----
> From: Nicolas Williams [mailto:Nicolas.Williams at ubsw.com]
> Sent: 22 May 2000 19:54
> To: Larsson, Johan
> Cc: Beauchamp, Andreas; samba-technical at samba.org
> Subject: Re: Samba in an HA environment
> 
> 
> 
> The trick is to run two instances of nmbd/smbd on a machine that is
> running two services (i.e., a machine that's taken over its disabled
> HA partner). Each instance of nmbd/smbd should bind only to the IP
> addresses of the virtual host they represent; see the 'interfaces' and
> 'bind interfaces only' configuration parameters in smb.conf(5). This
> means that you must be using the HA model whereby a one host takes over
> a disabled host's IP addresses and services.
> 
> 'source environment' is helpful in configuring both HA personalities
> with ONE smb.conf and an environment file or script that outputs an
> environment.
> 
> E.,g.,
> 
> 	...
> 	source environment = /etc/smb.conf.env.%$(HA_PERSONALITY)
> 	...
> 
> or
> 
> 	...
> 	source environment = /sbin/samba_config_env %$(HA_PERSONALITY) |
> 	...
> 
> 
> Nico
> 
> 
> On Mon, May 22, 2000 at 06:30:15PM +0200, Larsson, Johan wrote:
> > Hi!
> > 
> > I am trying to figure out how to use samba in an HA environment, split
> > across two service groups. The ideal setup would look as follows:
> > 
> > service group: A
> > IP address: 10.1.1.2
> > disk group: adg
> > samba share: /sg_a
> > 
> > service group: B
> > IP address: 10.1.1.3
> > disk group: bdg
> > samba share: /sg_b
> > 
> > These two service groups would be served by a cluster of two servers. It
> > would be straight forward in a normal situation, where the service groups
> > are either split across the two servers or running only on one. The
> headache
> > of course occurs when starting up and taking over. I dug out the
> discussion
> > regarding your patch "source environment" which finally made it into
> 2.0.7,
> > but I fail to see how it would help me... (This is me right!)
> > 
> > I don't know if I am totally out of bounds, but I would like to set it up
> so
> > that a failure in one service group would not have any impact on the other
> > if both service groups are running on the same server. That is, if one
> share
> > needs to be dropped from samba because the service group is failing over
> to
> > the standby server, the other share should not be impacted. Otherwise I
> > could always work around it by always starting and stopping samba and
> > copying different smb.conf files depending on what context samba was
> running
> > in.
> > 
> > Grateful if you could point me into some kind of viable direction.
> > 
> > Best regards,
> > Johan Larsson
> > European Central Bank
> > Frankfurt GERMANY
> > 
> --
--



More information about the samba-technical mailing list