Ambari服务器设置:OSError异常:[错误2]没有这样的文件或目录 [英] Ambari server setup: OSError: [Errno 2] No such file or directory

查看:2130
本文介绍了Ambari服务器设置:OSError异常:[错误2]没有这样的文件或目录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想设置的Hadoop在我的EC2实例使用本教程。我试图设置ambari服务器时,我得到这个错误:

I'm trying to setup Hadoop on my EC2 instance using this tutorial. I'm trying to setup the ambari server when I get this error:

[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 函数作为它的参数,所以这个问题可能无法启动的功能。我知道少量的蟒蛇,但因为节目做太多,我知道在哪里可以修复它​​。

I've looked this up and apparently os.rename is just renaming a file and when this error happens, it because some file I'm trying to rename doesn't exist. However I don't know what file it wants to rename and the readline function has self as its parameter so the problem may not start in the function. I know a small amount of python but since program is doing way too much for me to know where to fix it.

推荐答案

这可能是因为你有的Postgres 安装在其他位置。 它是要找的文件是的pg_hba.conf 你选择了默认的Postgres数据库的ambari,它很可能会寻找它在的/ var / lib中/的pgsql /数据/

It's likely that you have postgres installed in some other location. The file it's looking for is pg_hba.conf You chose the default postgres db for ambari and it will likely look for it under /var/lib/pgsql/data/

综观痕迹,它试图重命名文件,只是不能确定该文件到底是什么。
要真正了解这对于确保文件和位置,只需编辑python脚本: /usr/lib64/python2.6/fileinput.py

Looking at the trace, it's trying to rename the file, but just unsure what that file is exactly.
To really know which file and location for sure, simply edit the python script: /usr/lib64/python2.6/fileinput.py

上面添加了code一行打印在寻找文件:

Add a line above the code to print the files it's looking for:

print self._filename, ':', self._backupfilename                 
os.rename(self._filename, self._backupfilename)

注:我打了类似的情况,它是指向的/ var / lib中/的pgsql /数据,这是不存在的(真正的位置是在 /数据/ pghadoop )。所以我所做的就是创建一个符号链接到我的真实位置,即 LN -s /数据/ pghadoop /的/ var / lib中/的pgsql /数据。

Note: I hit a similar situation and it was pointing to /var/lib/pgsql/data, which did not exist (real location was under /data/pghadoop). So what I did was create a symbolic link to my real location, i.e. ln -s /data/pghadoop/ /var/lib/pgsql/data.

这篇关于Ambari服务器设置:OSError异常:[错误2]没有这样的文件或目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆