如果报错
[ceph_deploy.mon][ERROR ] RuntimeError: config file /etc/ceph/ceph.conf exists with different content; use –overwrite-conf to overwrite
则使用命令如下:
sudo ceph-deploy --overwrite-conf mon create-initial
可能会遇到问题
admin_socket: exception getting command descriptions: [Errno 2] No such file or directory
这个报错的原因有很多种,需要仔细看上面的报错信息。如果是重复安装不同版本例如:
之前安装了ceph-0.94.6的环境中重新安装ceph-10.2.5,只是卸载了ceph的包,没有对ceph的一些配置文件进行删除。
则使用命令修复:
rm -rf /etc/ceph/*
rm -rf /var/lib/ceph/*/*
rm -rf /var/log/ceph/*
rm -rf /var/run/ceph/*
#然后重新运行
sudo ceph-deploy new ceph1 ceph2 ceph3
sudo ceph-deploy mon create-initial
我这里的报错是
[ceph3][DEBUG ] determining if provided host has same hostname in remote
[ceph3][DEBUG ] get remote short hostname
[ceph3][WARNIN] ********************************************************************************
[ceph3][WARNIN] provided hostname must match remote hostname
[ceph3][WARNIN] provided hostname: ceph3
[ceph3][WARNIN] remote hostname: localhost
[ceph3][WARNIN] monitors may not reach quorum and create-keys will not complete
是因为hostname没对应。
使用命令分别修改三台机子的hostname为ceph1,ceph2,ceph3
修改运行时Linux系统的hostname,即不需要重启系统
hostname命令可以设置系统的hostname
sudo hostname ceph1
newname即要设置的新的hostname,运行后立即生效,但是在系统重启后会丢失所做的修改,如果要永久更改系统的hostname,就要修改相关的设置文件。
永久更改Linux的hostname
如果要永久修改RedHat的hostname,就修改/etc/sysconfig/network文件,将里面的HOSTNAME这一行修改成HOSTNAME=NEWNAME,其中NEWNAME就是你要设置的hostname。
Debian发行版的hostname的配置文件是/etc/hostname。
我们这里使用命令
sudo vi /etc/sysconfig/network
修该配置文件后,重启系统就会读取配置文件设置新的hostname。
可能遇到的问题
[ceph3][WARNIN] 2018-05-14 23:10:43.131747 7f7a3135e7a0 -1 accepter.accepter.bind unable to bind to 192.168.199.83:6789: (98) Address already in use
解决方法
发生这种问题是由于端口被程序绑定而没有释放造成.
可以使用netstat -lp命令或者ps aux|grep ceph查询当前处于连接的程序以及对应的进程信息。
然后用ps pid 察看对应的进程,并使用kill pid 关闭该进程即可
使用命令及输出如下:
netstat -lp
ps aux|grep ceph
ps pid
kill pid
输出如下:
[zzq@ceph2 ~]$ sudo netstat -lp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 ceph2:smc-https *:* LISTEN 1256/ceph-mon
tcp 0 0 localhost:27017 *:* LISTEN 1513/mongod
tcp 0 0 *:ssh *:* LISTEN 1154/sshd
tcp 0 0 localhost:smtp *:* LISTEN 1487/master
tcp 0 0 *:ssh *:* LISTEN 1154/sshd
tcp 0 0 localhost:smtp *:* LISTEN 1487/master
Active UNIX domain sockets (only servers)
Proto RefCnt Flags Type State I-Node PID/Program name Path
unix 2 [ ACC ] STREAM LISTENING 12680 1513/mongod /tmp/mongodb-27017.sock
unix 2 [ ACC ] STREAM LISTENING 12028 1256/ceph-mon /var/run/ceph/ceph-mon.localhost.asok
unix 2 [ ACC ] STREAM LISTENING 12524 1487/master public/cleanup
unix 2 [ ACC ] STREAM LISTENING 12531 1487/master private/tlsmgr
unix 2 [ ACC ] STREAM LISTENING 12535 1487/master private/rewrite
unix 2 [ ACC ] STREAM LISTENING 12539 1487/master private/bounce
unix 2 [ ACC ] STREAM LISTENING 12543 1487/master private/defer
unix 2 [ ACC ] STREAM LISTENING 12547 1487/master private/trace
unix 2 [ ACC ] STREAM LISTENING 12551 1487/master private/verify
unix 2 [ ACC ] STREAM LISTENING 12555 1487/master public/flush
unix 2 [ ACC ] STREAM LISTENING 12559 1487/master private/proxymap
unix 2 [ ACC ] STREAM LISTENING 12563 1487/master private/proxywrite
unix 2 [ ACC ] STREAM LISTENING 12567 1487/master private/smtp
unix 2 [ ACC ] STREAM LISTENING 12571 1487/master private/relay
unix 2 [ ACC ] STREAM LISTENING 12575 1487/master public/showq
unix 2 [ ACC ] STREAM LISTENING 12579 1487/master private/error
unix 2 [ ACC ] STREAM LISTENING 12583 1487/master private/retry
unix 2 [ ACC ] STREAM LISTENING 12587 1487/master private/discard
unix 2 [ ACC ] STREAM LISTENING 12591 1487/master private/local
unix 2 [ ACC ] STREAM LISTENING 12595 1487/master private/virtual
unix 2 [ ACC ] STREAM LISTENING 12599 1487/master private/lmtp
unix 2 [ ACC ] STREAM LISTENING 12603 1487/master private/anvil
unix 2 [ ACC ] STREAM LISTENING 12607 1487/master private/scache
unix 2 [ ACC ] STREAM LISTENING 9512 1/init @/com/ubuntu/upstart
[zzq@ceph2 ~]$ ps aux|grep ceph
root 1256 0.3 2.5 235060 25536 ? Sl 23:04 0:08 /usr/bin/ceph-mon -i localhost --pid-file /var/run/ceph/mon.localhost.pid -c /etc/ceph/ceph.conf --cluster ceph
zzq 4871 0.0 0.0 103320 880 pts/0 S+ 23:41 0:00 grep ceph
[zzq@ceph2 ~]$ ps 1256
PID TTY STAT TIME COMMAND
1256 ? Sl 0:08 /usr/bin/ceph-mon -i localhost --pid-file /var/run/ceph/mon.localhost.pid -c /etc/ceph/ceph.conf --cluster ceph
[zzq@ceph2 ~]$ kill 1256
-bash: kill: (1256) - Operation not permitted
[zzq@ceph2 ~]$ sudo kill 1256
[zzq@ceph2 ~]$ |