Cassandra

嘗試安裝 datastax opscenter - 無法載入應用程序:無法導入名稱 _parse

  • September 5, 2016

我對python不熟悉,也許有人可以解釋這裡發生了什麼?

ec2-user@prod-opscenter-01:~ % java -version
java version "1.7.0_45"
Java(TM) SE Runtime Environment (build 1.7.0_45-b18)
Java HotSpot(TM) 64-Bit Server VM (build 24.45-b08, mixed mode)

ec2-user@prod-opscenter-01:~ % python -V
Python 2.6.8

ec2-user@prod-opscenter-01:~ % openssl version
OpenSSL 1.0.1e-fips 11 Feb 2013

現在錯誤


ec2-user@prod-opscenter-01:~ % sudo /etc/init.d/opscenterd start
Starting Cassandra cluster manager opscenterd
Starting opscenterdUnhandled Error
Traceback (most recent call last):
 File "/usr/lib64/python2.6/site-packages/twisted/application/app.py", line 652, in run
   runApp(config)
 File "/usr/lib64/python2.6/site-packages/twisted/scripts/twistd.py", line 23, in runApp
   _SomeApplicationRunner(config).run()
 File "/usr/lib64/python2.6/site-packages/twisted/application/app.py", line 386, in run
   self.application = self.createOrGetApplication()
 File "/usr/lib64/python2.6/site-packages/twisted/application/app.py", line 451, in createOrGetApplication
   application = getApplication(self.config, passphrase)
--- <exception caught here> ---
 File "/usr/lib64/python2.6/site-packages/twisted/application/app.py", line 462, in getApplication
   application = service.loadApplication(filename, style, passphrase)
 File "/usr/lib64/python2.6/site-packages/twisted/application/service.py", line 405, in loadApplication
   application = sob.loadValueFromFile(filename, 'application', passphrase)
 File "/usr/lib64/python2.6/site-packages/twisted/persisted/sob.py", line 210, in loadValueFromFile
   exec fileObj in d, d
 File "bin/start_opscenter.py", line 1, in <module>
   from opscenterd import opscenterd_tap
 File "/usr/lib/python2.6/site-packages/opscenterd/opscenterd_tap.py", line 37, in <module>

 File "/usr/lib/python2.6/site-packages/opscenterd/OpsCenterdService.py", line 13, in <module>

 File "/usr/lib/python2.6/site-packages/opscenterd/ClusterServices.py", line 22, in <module>

 File "/usr/lib/python2.6/site-packages/opscenterd/WebServer.py", line 40, in <module>

 File "/usr/lib/python2.6/site-packages/opscenterd/Agents.py", line 18, in <module>

exceptions.ImportError: cannot import name _parse

Failed to load application: cannot import name _parse

也許我應該看看監控 cassandra 的開源替代方案?

非常感謝

導致錯誤的行是from twisted.web.client import Agent, _parse。OpsCenter 將一個 twisted 版本與它的發行版捆綁在一起,以確保適當的兼容性。聽起來您在正在使用的系統上安裝了不兼容的 twisted 版本。

編輯:Amazon Linux AMI 存在一個已知問題。在 /user/share/opscenter/bin/opscenter 中,在 export PYTHONPATH=… 之前添加以下行: PY_DISTRO="./lib/py-redhat/ $ {PY_VER}/shared/ $ {PY_ARCH}:./lib/py-redhat/ $ {PY_VER‌​}/6/ $ {PY_ARCH}"

我們將不得不考慮在 OpsCenter 本身內更好地處理這個問題,但同時刪除第三方安裝的 twisted,雖然不優雅,但肯定會讓您啟動並執行。

要確定是否/安裝了 twisted: python -c "import twisted; print twisted"

引用自:https://serverfault.com/questions/548499