轉載請說明出處:http://blog.csdn.net/cywosp/article/details/23850893
最近在開發過程中遇到了swift中合理的bug,為什麼說合理呢。且看bug的情境描述。 現在有兩台伺服器A和B用於配製swift叢集,由於某種原因A上的磁碟都沒有被加入到ring檔案中,只有B中的磁碟被加入了進來,但是A和B的/etc/swift/目錄中所有ring檔案都是對應相同的,如果當前A上的/srv/node目錄不存在,此時分別去開啟兩太機器所有的swift服務,那麼B將沒有任何錯誤而A機器上將會報如下錯誤: Apr 15 02:35:23 localhost object-updater UNCAUGHT EXCEPTION#012Traceback (most recent call last):#012 File "/usr/bin/swift-object-updater", line 23, in <module>#012 run_daemon(ObjectUpdater, conf_file, **options)#012 File "/usr/lib/python2.6/site-packages/swift/common/daemon.py", line 110, in run_daemon#012 klass(conf).run(once=once, **kwargs)#012 File "/usr/lib/python2.6/site-packages/swift/common/daemon.py", line 57, in run#012 self.run_forever(**kwargs)#012 File "/usr/lib/python2.6/site-packages/swift/obj/updater.py", line 73, in run_forever#012 for device in os.listdir(self.devices):#012OSError: [Errno 2] No such file or directory: '/srv/node'
Apr 15 02:33:10 localhost container-updater UNCAUGHT EXCEPTION#012Traceback (most recent call last):#012 File "/usr/bin/swift-container-updater", line 23, in <module>#012 run_daemon(ContainerUpdater, conf_file, **options)#012 File "/usr/lib/python2.6/site-packages/swift/common/daemon.py", line 110, in run_daemon#012 klass(conf).run(once=once, **kwargs)#012 File "/usr/lib/python2.6/site-packages/swift/common/daemon.py", line 57, in run#012 self.run_forever(**kwargs)#012 File "/usr/lib/python2.6/site-packages/swift/container/updater.py", line 123, in run_forever#012 for path in self.get_paths():#012 File "/usr/lib/python2.6/site-packages/swift/container/updater.py", line 80, in get_paths#012 for device in os.listdir(self.devices):#012OSError: [Errno 2] No such file or directory: '/srv/node' 通過上面的日誌我們可以知道object-updater和container-updater兩個進程都發生未知異常,從而奔潰了。
從上面的描述可以解釋為什麼該問題是合理的了,因為A伺服器上沒有任何存放裝置,因此,所有資料都不會被寫到該節點上,該節點只相當於一個proxy部署節點,除了proxy服務外其他所有服務都可以關閉,所以object-updater和container-updater停止了,將是對系統資源的釋放。