Create a Dockerfile
with the following content.
FROM ubuntu:16.04
RUN apt update
RUN apt install -y \
\
sudo sqlite3 libxml2 psmisc
python2.7-minimal net-tools kmodRUN apt install -y \
\
mercurial gcc g++ libxml2-dev automake \
m4 autoconf libtool pkg-config
make python-dev libsqlite3-dev binutilsRUN apt install -y \
vim iputils-ping rsyslog
RUN cd /root && hg clone http://hg.code.sf.net/p/opensaf/staging opensaf-staging
WORKDIR /root/opensaf-staging
RUN ./bootstrap.sh
RUN ./configure --enable-tipc CPPFLAGS="-DRUNASROOT"
RUN make -j `nproc`
RUN make install
RUN ldconfig
Build docker image.
$ docker build --progress=plain -t opensaf .
$ docker run --privileged -it --name node1 -h SC-1 opensaf
Generate /etc/opensaf/imm.xml
.
$ cd /usr/local/share/opensaf/immxml/
# generate nodes.cfg
$ ./immxml-clustersize --sc-count 2
Successful, result stored in the file ./nodes.cfg
$ ./immxml-configure
Successfully generated the imm file: ./imm.xml.20241015_1721
$ cp ./imm.xml.20241015_1721 /etc/opensaf/imm.xml
Edit /etc/opensaf/node_name
.
SC-1
# SC-1: hostname.
Edit /etc/opensaf/nid.conf
.
# MDS transport protocol, values supported are TIPC or TCP
export MDS_TRANSPORT=TCP
Edit /etc/opensaf/dtmd.conf
.
DTM_NODE_IP=172.17.0.2
# 172.17.0.2: IP of the eth0 interface.
Edit /etc/opensaf/slot_id
.
1
Edit /etc/opensaf/node_type
.
controller
Start OpenSAF.
$ /etc/init.d/opensafd start
Starting OpenSAF Services (Using TCP): *
Check status.
$ /etc/init.d/opensafd status
safSISU=safSu=SC-1\,safSg=NoRed\,safApp=OpenSAF,safSi=NoRed1,safApp=OpenSAF
saAmfSISUHAState=ACTIVE(1)
safSISU=safSu=SC-1\,safSg=2N\,safApp=OpenSAF,safSi=SC-2N,safApp=OpenSAF
saAmfSISUHAState=ACTIVE(1)
$ docker run --privileged -it --name node2 -h SC-2 opensaf
Edit /etc/opensaf/node_name
.
SC-2
# SC-2: hostname.
Edit /etc/opensaf/nid.conf
.
# MDS transport protocol, values supported are TIPC or TCP
export MDS_TRANSPORT=TCP
Edit /etc/opensaf/dtmd.conf
.
DTM_NODE_IP=172.17.0.3
# 172.17.0.3: IP of the eth0 interface.
Edit /etc/opensaf/slot_id
.
2
Edit /etc/opensaf/node_type
.
controller
Start rsyslog because opensaf print logs to rsyslog.
$ /etc/init.d/rsyslog start
Start opensaf.
$ /etc/init.d/opensafd start
Starting OpenSAF Services (Using TCP): *
Check status.
$ /etc/init.d/opensafd status
safSISU=safSu=SC-1\,safSg=2N\,safApp=OpenSAF,safSi=SC-2N,safApp=OpenSAF
saAmfSISUHAState=ACTIVE(1)
safSISU=safSu=SC-1\,safSg=NoRed\,safApp=OpenSAF,safSi=NoRed1,safApp=OpenSAF
saAmfSISUHAState=ACTIVE(1)
safSISU=safSu=SC-2\,safSg=NoRed\,safApp=OpenSAF,safSi=NoRed2,safApp=OpenSAF
saAmfSISUHAState=ACTIVE(1)
safSISU=safSu=SC-2\,safSg=2N\,safApp=OpenSAF,safSi=SC-2N,safApp=OpenSAF
saAmfSISUHAState=STANDBY(2)
Check state of nodes.
$ amf-state node
safAmfNode=SC-1,safAmfCluster=myAmfCluster
saAmfNodeAdminState=UNLOCKED(1)
saAmfNodeOperState=ENABLED(1)
safAmfNode=SC-2,safAmfCluster=myAmfCluster
saAmfNodeAdminState=UNLOCKED(1)
saAmfNodeOperState=ENABLED(1)
Check /var/log/syslog
on SC-1.
SC-1 osafdtmd[133]: NO Established contact with 'SC-2'
SC-1 osafamfd[224]: NO Node 'SC-2' joined the cluster
Check /var/log/syslog
on SC-2.
SC-2 osafdtmd[70]: NO Established contact with 'SC-1'
SC-2 osafclmna[83]: NO safNode=SC-2,safCluster=myClmCluster Joined cluster, nodeid=2020f
SC-2 osafamfd[154]: NO Cold sync complete!