文章目录
1.记录新装的oceanbase,使用observer帮助时,出现lib文件无法找到的处理过程
bash
./observer --help
./observer: error while loading shared libraries: libmariadb.so.3: cannot open shared object file: No such file or directory
2.做一个strace跟踪,发现是某些lib文件无法找到
bash
strace ./observer
输出截取如下:
bash
openat(AT_FDCWD, "/usr/lib/libmariadb.so.3", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
writev(2, [{iov_base="./observer", iov_len=10}, {iov_base=": ", iov_len=2}, {iov_base="error while loading shared libra"..., iov_len=36}, {iov_base=": ", iov_len=2}, {iov_base="libmariadb.so.3", iov_len=15}, {iov_base=": ", iov_len=2}, {iov_base="cannot open shared object file", iov_len=30}, {iov_base=": ", iov_len=2}, {iov_base="No such file or directory", iov_len=25}, {iov_base="\n", iov_len=1}], 10./observer: error while loading shared libraries: libmariadb.so.3: cannot open shared object file: No such file or directory
) = 125
exit_group(127) = ?
+++ exited with 127 +++
obadmin@obsrv01:~/myoceanb
4.使用ldd查看observer依赖的lib库文件,结果有libmariadb.so.3,libaio.so.1两个文件是not found
bash
obadmin@obsrv01:~/myoceanbase/oceanbase/bin$ ldd ./observer
linux-vdso.so.1 (0x00007ffd27bdb000)
librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007ff1f16cd000)
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007ff1f16c8000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007ff1f15df000)
libmariadb.so.3 => not found
libaio.so.1 => not found
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007ff1f15d8000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007ff1c7a00000)
/lib64/ld-linux-x86-64.so.2 (0x00007ff1f16da000)
5.使用find查找文件时,发现oceanbase的lib库文件夹实际上有这个文件
bash
sudo find / -name libmariadb.so.3
/home/obadmin/.obd/repository/oceanbase-ce-libs/4.3.1.0/68f0b5f988bd5fb80d44ac29afad0c2b2f2d3763/libmariadb.so.3
/home/obadmin/myoceanbase/oceanbase/lib/libmariadb.so.3
6.使用ls确认,libmariadb与libaio两个文件都在/home/obadmin/myoceanbase/oceanbase/lib/文件夹下
bash
ls /home/obadmin/myoceanbase/oceanbase/lib/libmariadb.so /home/obadmin/myoceanbase/oceanbase/lib/libaio.so.1.0.1
/home/obadmin/myoceanbase/oceanbase/lib/libaio.so.1.0.1
/home/obadmin/myoceanbase/oceanbase/lib/libmariadb.so
7.查询$LD_LIBRARY_PATH,结果返回空值
bash
echo $LD_LIBRARY_PATH
8.设置LD_LIBRARY_PATH
bash
export LD_LIBRARY_PATH=/home/obadmin/myoceanbase/oceanbase/lib
9.再次查询LD_LIBRARY_PATH变量,这回有值了
bash
echo $LD_LIBRARY_PATH
/home/obadmin/myoceanbase/oceanbase/lib
10.再次运行observer
bash
./observer --help
./observer --help
observer [OPTIONS]
-h,--help print this help
-z,--zone ZONE zone
-p,--mysql_port PORT mysql port
-P,--rpc_port PORT rpc port
-N,--nodaemon don't run in daemon
-n,--appname APPNAME application name
-c,--cluster_id ID cluster id
-d,--data_dir DIR OceanBase data directory
-i,--devname DEV net dev interface
-I,--local_ip ip of the current machine
-o,--optstr OPTSTR extra options string
-r,--rs_list RS_LIST root service list
-l,--log_level LOG_LEVEL server log level
-6,--ipv6 USE_IPV6 server use ipv6 address
-m,--mode MODE server mode
-f,--scn flashback_scn