在ubuntu下安装opensaf
别永年
2023-12-01
周末用了两个晚上安装成功了opensaf,发文总结一下安装过程,和其他菜鸟共享。
系统信息:
虚拟机: Oracle VirtualBox
操作系统: ubuntu 2.6.38-12-generic
1. 安装opensaf依赖的类库,我这里只缺libxml2和tipc-config:
1) 更新apt-get
sudo apt-get update
2) 安装libxml2和libxml2-dev:(rpm转换成deb包安装没有成功)
sudo apt-get install libxml2
sudo apt-get install libxml2-dev
sudo apt-get install autoconf
3)安装tipc-config:
下载tipc utilities v2.0.0: http://tipc.sourceforge.net/tipc_linux.shtml
解压后用make来build,生成tipc-config,全路径为:/home/ubuntu/Downloads/tipcutils-2.0.0/tipc-config/tipc-config
在/root/.bashrc里把tipc-config的路径添加到PATH环境变量并执行source /root/.bashrc。
PATH=$PATH:/home/ubuntu/Downloads/tipcutils-2.0.0/tipc-config
export PATH
2. 安装opensaf:
1) 下载opensaf http://devel.opensaf.org/downloads
2) 解压后./configure, make, make install安装。(缺省的enable TIPC,参考TIPC和TCP性能比较:http://www.strlen.de/tipc/)
3)运行opensafd失败,/var/log/syslog里显示如下错误信息:
Jun 23 19:18:46 ubuntu-VirtualBox osafrded[5517]: Started
Jun 23 19:18:46 ubuntu-VirtualBox osafrded[5517]: bind FAILED Permission denied
Jun 23 19:18:46 ubuntu-VirtualBox osafrded[5517]: remove /var/lib/opensaf/rde_rda.sock FAILED No such file or directory
Jun 23 19:18:46 ubuntu-VirtualBox opensafd[5497]: Failed #012 DESC:RDE
Jun 23 19:18:46 ubuntu-VirtualBox opensafd[5497]: Going for recovery
Jun 23 19:18:46 ubuntu-VirtualBox opensafd[5497]: Trying To RESPAWN /usr/local/lib/opensaf/clc-cli/osaf-rded attempt #1
Jun 23 19:18:46 ubuntu-VirtualBox opensafd[5497]: Sending SIGKILL to RDE, pid=5511
Jun 23 19:18:46 ubuntu-VirtualBox osafrded[5517]: Exiting...
权限问题。
从opensaf的论坛里查到如下solution:
首先创建opensaf的group: groupadd opensaf,然后执行下面的命令:
[list]
[*]1) useradd -r -g opensaf -d /usr/local/share/opensaf/ -s /sbin/nologin -c "OpenSAF" opensaf
[*]2) echo "opensaf ALL = NOPASSWD: /sbin/reboot, /home/ubuntu/Downloads/tipcutils-2.0.0/tipc-config/, /usr/bin/pkill" >> /etc/sudoers
[*]3) echo 'Defaults:%opensaf !requiretty' >> /etc/sudoers
[*]4) echo 'Defaults:opensaf !requiretty' >> /etc/sudoers
[*]5) chown opensaf /var/lib/opensaf
[*]6) chgrp opensaf /var/lib/opensaf
[*]7) chown opensaf /var/run/opensaf
[*]8) chgrp opensaf /var/run/opensaf
[*]9) chown -R opensaf /var/log/opensaf
[*]10) chgrp -R opensaf /var/log/opensaf
[/list]
4)继续运行opensafd失败,/var/log/syslog里显示如下错误信息:
Jun 23 19:42:47 ubuntu-VirtualBox immload: Load starting
Jun 23 19:42:47 ubuntu-VirtualBox immload: ***** Loading from XML file imm.xml at /etc/opensaf *****
Jun 23 19:42:47 ubuntu-VirtualBox immload: ***** FILE:/etc/opensaf/imm.xml IS NOT ACCESSIBLE ***********
Jun 23 19:42:47 ubuntu-VirtualBox immload: Load from imm.xml file ending ABNORMALLY dir:/etc/opensaf file:imm.xml
Jun 23 19:42:47 ubuntu-VirtualBox osafimmnd[6414]: LOADING APPARENTLY FAILED status:1
Jun 23 19:42:47 ubuntu-VirtualBox osafimmd[6406]: ******** LOADING FAILED. File(s) possibly missing, inaccessible or corrupt .. ? *********
Jun 23 19:42:47 ubuntu-VirtualBox osafimmnd[6414]: IMMND - Periodic server job failed
Jun 23 19:42:47 ubuntu-VirtualBox osafimmnd[6414]: Failed, exiting...
发现文件/etc/opensaf/imm.xml不存在,用下面的方法生成imm.xml:
cd /usr/local/share/opensaf/immxml/
如果需要修改主备设备数量,或主备设备hostname,需要在此目录下执行下面操作
./immxml-clustersize -s 1
修改刚才生成的nodes.cfg,将其中的SC-1改为对应的主机名(必须于/etc/opensaf/node_name 一致)
./immxml-configure
cp imm.xml.20100217_2201 /etc/opensaf/imm.xml
5)修改/etc/opensaf/nodeinit.conf里TIPC参数:
/usr/local/lib/opensaf/nid_tipc:TIPC:S:/usr/local/lib/opensaf/nid_tipc:4000::2:1:start [b][color=red]eth3[/color][/b] 1234:stop
root@ubuntu-VirtualBox:/etc/opensaf# ifconfig -a
eth3 Link encap:Ethernet HWaddr 08:00:27:e8:ff:a6
inet addr:10.0.2.15 Bcast:10.0.2.255 Mask:255.255.255.0
inet6 addr: fe80::a00:27ff:fee8:ffa6/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:4 errors:0 dropped:0 overruns:0 frame:0
TX packets:36 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:1300 (1.3 KB) TX bytes:8557 (8.5 KB)
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:6475 errors:0 dropped:0 overruns:0 frame:0
TX packets:6475 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:474472 (474.4 KB) TX bytes:474472 (474.4 KB)
6)启动opensafd:
/etc/init.d/opensafd start
查看日志没有再报错 tail -f /var/log/syslog
其他opensaf的log在/var/log/opensaf/下:
root@ubuntu-VirtualBox:/var/log/opensaf# ls *
mds.log nid.log
dtlog:
saflog:
saLogAlarm_20120623_205543.log saLogNotification_20120623_205543.log saLogSystem_20120623_205543.log
saLogAlarm_20120623_205945.log saLogNotification_20120623_205945.log saLogSystem_20120623_205945.log
saLogAlarm_20120623_210633.log saLogNotification_20120623_210633.log saLogSystem_20120623_210633.log
saLogAlarm_20120624_140443.log saLogNotification_20120624_140443.log saLogSystem_20120624_140443.log
saLogAlarm.cfg saLogNotification.cfg saLogSystem.cfg
下面是启动的进程。
root@ubuntu-VirtualBox:/etc/opensaf# ps -ef|grep opensaf
root 1746 1 0 14:04 ? 00:00:01 /bin/bash /usr/local/lib/opensaf/nid_tipc start lo 1234
opensaf 1766 1 0 14:04 ? 00:00:00 /usr/local/lib/opensaf/osafrded
opensaf 1779 1 0 14:04 ? 00:00:00 /usr/local/lib/opensaf/osaffmd
opensaf 1786 1 0 14:04 ? 00:00:00 /usr/local/lib/opensaf/osafimmd
opensaf 1795 1 0 14:04 ? 00:00:03 /usr/local/lib/opensaf/osafimmnd
opensaf 1859 1 0 14:04 ? 00:00:00 /usr/local/lib/opensaf/osaflogd
opensaf 1873 1 0 14:04 ? 00:00:00 /usr/local/lib/opensaf/osafntfd
opensaf 1881 1 0 14:04 ? 00:00:00 /usr/local/lib/opensaf/osafclmd
opensaf 1896 1 0 14:04 ? 00:00:01 /usr/local/lib/opensaf/osafamfd
root 1904 1 0 14:04 ? 00:00:03 /usr/local/lib/opensaf/osafamfnd
root 1917 1 0 14:04 ? 00:00:00 /usr/local/lib/opensaf/osafsmfnd
opensaf 1919 1 0 14:04 ? 00:00:00 /usr/local/lib/opensaf/osafsmfd
opensaf 1930 1 0 14:04 ? 00:00:00 /usr/local/lib/opensaf/osafmsgnd
opensaf 1965 1 0 14:04 ? 00:00:00 /usr/local/lib/opensaf/osaflcknd
opensaf 1974 1 0 14:04 ? 00:00:00 /usr/local/lib/opensaf/osafmsgd
opensaf 1980 1 0 14:04 ? 00:00:00 /usr/local/lib/opensaf/osafckptnd
opensaf 1994 1 0 14:04 ? 00:00:00 /usr/local/lib/opensaf/osafamfwd
opensaf 2001 1 0 14:04 ? 00:00:00 /usr/local/lib/opensaf/osaflckd
opensaf 2008 1 0 14:04 ? 00:00:00 /usr/local/lib/opensaf/osafevtd
opensaf 2024 1 0 14:04 ? 00:00:00 /usr/local/lib/opensaf/osafckptd