我正在尝试使用本教程在我的 EC2 实例上设置 Hadoop。当我收到此错误时,我正在尝试设置 ambari 服务器:
[root@ip-xxx-xxx-xxx-xxx ec2-user]# ambari-server setup
Using python /usr/bin/python2.6
Setup ambari-server
Checking SELinux...
WARNING: Could not run /usr/sbin/sestatus: OK
Ambari-server daemon is configured to run under user 'root'. Change this setting [y/n] (n)?
Adjusting ambari-server permissions and ownership...
Checking iptables...
Checking JDK...
JCE Policy archive already exists, using /var/lib/ambari-server/resources/jce_policy-6.zip
Completing setup...
Configuring database...
Enter advanced database configuration [y/n] (n)?
Default properties detected. Using built-in database.
Checking PostgreSQL...
Configuring local database...
Connecting to the database. Attempt 1...
Configuring PostgreSQL...
Traceback (most recent call last):
File "/usr/sbin/ambari-server.py", line 4242, in <module>
main()
File "/usr/sbin/ambari-server.py", line 4061, in main
setup(options)
File "/usr/sbin/ambari-server.py", line 2129, in setup
retcode = configure_postgres()
File "/usr/sbin/ambari-server.py", line 863, in configure_postgres
configure_pg_hba_postgres_user()
File "/usr/sbin/ambari-server.py", line 841, in configure_pg_hba_postgres_user
for line in fileinput.input(PG_HBA_CONF_FILE, inplace=1):
File "/usr/lib64/python2.6/fileinput.py", line 253, in next
line = self.readline()
File "/usr/lib64/python2.6/fileinput.py", line 322, in readline
os.rename(self._filename, self._backupfilename)
OSError: [Errno 2] No such file or directory
我已经查过了,显然os.rename
只是重命名了一个文件,当这个错误发生时,这是因为我试图重命名的某个文件不存在。但是我不知道它要重命名哪个文件,并且该readline
函数将self
其作为参数,因此问题可能不会在函数中开始。我知道少量的python,但由于程序做得太多,我不知道在哪里修复它。