1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-22 13:34:15 +03:00

use /etc/services for ctdb

(This used to be ctdb commit 64bf6964ff33320c5351337c7f8ed4da5bd71275)
This commit is contained in:
Andrew Tridgell 2007-05-29 15:15:00 +10:00
parent db5862279b
commit 2d9e0ad56a
17 changed files with 50 additions and 64 deletions

View File

@ -39,12 +39,12 @@ static struct {
const char *logfile;
const char *events;
} ctdb_cmdline = {
.nlist = NULL,
.nlist = "/etc/ctdb/nodes",
.transport = "tcp",
.myaddress = NULL,
.socketname = CTDB_PATH,
.self_connect = 0,
.db_dir = NULL,
.db_dir = VARDIR "/ctdb",
.torture = 0,
.logfile = NULL,
};

View File

@ -65,15 +65,18 @@ int ctdb_parse_address(struct ctdb_context *ctdb,
TALLOC_CTX *mem_ctx, const char *str,
struct ctdb_address *address)
{
char *p;
p = strchr(str, ':');
if (p == NULL) {
ctdb_set_error(ctdb, "Badly formed node '%s'\n", str);
return -1;
}
struct servent *se;
setservent(0);
se = getservbyname("ctdb", "tcp");
endservent();
address->address = talloc_strndup(mem_ctx, str, p-str);
address->port = strtoul(p+1, NULL, 0);
address->address = talloc_strdup(mem_ctx, str);
if (se == NULL) {
address->port = CTDB_PORT;
} else {
address->port = ntohs(se->s_port);
}
return 0;
}

View File

@ -1,4 +1,4 @@
127.0.0.1:9001
127.0.0.2:9001
127.0.0.3:9001
127.0.0.4:9001
127.0.0.1
127.0.0.2
127.0.0.3
127.0.0.4

View File

@ -1,2 +1,2 @@
127.0.0.1:9001
127.0.0.2:9001
127.0.0.1
127.0.0.2

View File

@ -11,10 +11,9 @@ After then:
Example for testing
===================
bin/ctdb_test --transport ib --nlist ../2nodes_rm.txt --listen 10.0.0.1:9001
bin/ctdb_test --transport ib --nlist ../2nodes_rm.txt --listen 10.0.0.2:9001
bin/ctdb_test --transport ib --nlist ../2nodes_rm.txt --listen 10.0.0.1
bin/ctdb_test --transport ib --nlist ../2nodes_rm.txt --listen 10.0.0.2
where 2nodes_rm.txt:
10.0.0.1:9001
10.0.0.2:9001
10.0.0.1
10.0.0.2

View File

@ -28,6 +28,9 @@
/* location of daemon socket */
#define CTDB_PATH "/tmp/ctdb.socket"
/* default ctdb port number */
#define CTDB_PORT 9001
/* we must align packets to ensure ctdb works on all architectures (eg. sparc) */
#define CTDB_DS_ALIGNMENT 8

View File

@ -12,7 +12,7 @@ Group: System Environment/Daemons
URL: bzr://www.samba.org/~tridge/ctdb/
Source: ctdb-%{version}.tar.bz2
Source999: setup.tar.bz2
Source999: ctdb-setup.tar.bz2
Prereq: /sbin/chkconfig /bin/mktemp /usr/bin/killall
Prereq: fileutils sed /etc/init.d
@ -36,15 +36,7 @@ ctdb is the clustered database used by samba
%build
# RPM_OPT_FLAGS="$RPM_OPT_FLAGS -D_FILE_OFFSET_BITS=64"
## check for ccache
# ccache -h 2>&1 > /dev/null
#if [ $? -eq 0 ]; then
# CC="ccache gcc"
#else
CC="gcc"
#fi
CC="gcc"
## always run autogen.sh
./autogen.sh
@ -52,11 +44,8 @@ ctdb is the clustered database used by samba
CFLAGS="$RPM_OPT_FLAGS $EXTRA -D_GNU_SOURCE" ./configure \
--prefix=%{_prefix} \
make showflags
make
%install
# Clean up in case there is trash left from a previous build
rm -rf $RPM_BUILD_ROOT
@ -65,12 +54,11 @@ rm -rf $RPM_BUILD_ROOT
mkdir -p $RPM_BUILD_ROOT%{_includedir}
mkdir -p $RPM_BUILD_ROOT{%{_libdir},%{_includedir}}
mkdir -p $RPM_BUILD_ROOT%{_prefix}/{bin,sbin}
mkdir -p $RPM_BUILD_ROOT%{_prefix}/lib
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/ctdb
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/rc.d/init.d
make DESTDIR=$RPM_BUILD_ROOT \
install
make DESTDIR=$RPM_BUILD_ROOT install
install -m644 setup/ctdb.sysconfig $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/ctdb
install -m755 setup/ctdb.init $RPM_BUILD_ROOT%{initdir}/ctdb
@ -106,15 +94,7 @@ fi
%config(noreplace) %{_sysconfdir}/sysconfig/ctdb
%attr(755,root,root) %config %{initdir}/ctdb
%{_bindir}/ctdbd
%{_bindir}/ctdb_test
%{_bindir}/ctdbd_test
%{_bindir}/ctdb_control
%{_bindir}/ctdb_bench
%{_bindir}/ctdb_fetch
%{_bindir}/ctdb_fetch1
%{_bindir}/ctdb_messaging
%{_bindir}/lockwait
%{_sysconfdir}/ctdb/events
%{_sbindir}/ctdbd
%{_bindir}/ctdb
%{_includedir}/ctdb.h

View File

@ -71,7 +71,7 @@ popd
##
## copy additional source files
##
tar --exclude=.svn -jcvf - setup > ${SRCDIR}/setup.tar.bz2
tar --exclude=.svn -jcvf - setup > ${SRCDIR}/ctdb-setup.tar.bz2
cp -p ${SPECFILE} ${SPECDIR}
##

View File

@ -1 +1 @@
127.0.0.1:9001
127.0.0.1

View File

@ -1,4 +1,4 @@
127.0.0.1:9001
127.0.0.2:9001
127.0.0.3:9001
127.0.0.4:9001
127.0.0.1
127.0.0.2
127.0.0.3
127.0.0.4

View File

@ -18,7 +18,7 @@ echo "Creating nodes-ssh.txt"
rm -f nodes-ssh.txt
count=0
for h in $nodes; do
echo "$h:9001" >> nodes-ssh.txt
echo "$h" >> nodes-ssh.txt
count=`expr $count + 1`
done

View File

@ -9,7 +9,7 @@ fi
rm -f nodes.txt
for i in `seq 1 $NUMNODES`; do
echo 127.0.0.$i:9001 >> nodes.txt
echo 127.0.0.$i >> nodes.txt
done
killall -9 ctdb_bench

View File

@ -7,7 +7,7 @@ fi
rm -f nodes.txt
for i in `seq 1 $NUMNODES`; do
echo 127.0.0.$i:9001 >> nodes.txt
echo 127.0.0.$i >> nodes.txt
done
killall -9 ctdb_fetch

View File

@ -11,7 +11,7 @@ fi
rm -f nodes.txt
for i in `seq 1 $NUMNODES`; do
echo 127.0.0.$i:9001 >> nodes.txt
echo 127.0.0.$i >> nodes.txt
done
killall -9 ctdb_messaging

View File

@ -1,2 +1,3 @@
127.0.0.1:9001
127.0.0.2:9001
127.0.0.1
127.0.0.2

View File

@ -4,9 +4,9 @@ killall -q ctdbd
echo "Starting 4 ctdb daemons"
bin/ctdbd --recovery-daemon --nlist direct/4nodes.txt
bin/ctdbd --recovery-daemon --nlist direct/4nodes.txt --listen=127.0.0.2:9001 --socket=/tmp/ctdb.socket.127.0.0.2
bin/ctdbd --recovery-daemon --nlist direct/4nodes.txt --listen=127.0.0.3:9001 --socket=/tmp/ctdb.socket.127.0.0.3
bin/ctdbd --recovery-daemon --nlist direct/4nodes.txt --listen=127.0.0.4:9001 --socket=/tmp/ctdb.socket.127.0.0.4
bin/ctdbd --recovery-daemon --nlist direct/4nodes.txt --listen=127.0.0.2 --socket=/tmp/ctdb.socket.127.0.0.2
bin/ctdbd --recovery-daemon --nlist direct/4nodes.txt --listen=127.0.0.3 --socket=/tmp/ctdb.socket.127.0.0.3
bin/ctdbd --recovery-daemon --nlist direct/4nodes.txt --listen=127.0.0.4 --socket=/tmp/ctdb.socket.127.0.0.4
echo
echo "Attaching to some databases"

View File

@ -12,7 +12,7 @@ fi
rm -f nodes.txt
for i in `seq 1 $NUMNODES`; do
echo 127.0.0.$i:9001 >> nodes.txt
echo 127.0.0.$i >> nodes.txt
done
killall -9 ctdb_test