Reputation: 1932
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
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.
Upvotes: 1
Views: 2926
Reputation: 51
If we tried to install Ambari server under Amazon Linux with its bundled postgresql db, you should get error on ambari-server
setup.
The first root cause is the startup script postgresql assumes the default data path is at:
/var/lib/pgsql92/data
However, we can see nothing under: /var/lib/pgsql92/data
Instead of, we should see thing under: /var/lib/pgsql9
Here is workaround:
sudo ln -s /var/lib/pgsql9 /var/lib/pgsql
# sudo vim /etc/init.d/postgresql
-- comment it:
#PGSUFFIX=92
-- change below:
PGDATA=/var/lib/pgsql${PGSUFFIX}/data
PGLOG=/var/lib/pgsql${PGSUFFIX}/pgstartup.log
To:
PGDATA=/var/lib/pgsql/data
PGLOG=/var/lib/pgsql/pgstartup.log
Upvotes: 1
Reputation: 11
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/
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
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)
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.
Upvotes: 1
Reputation: 139
Can't comment questions yet unfortunately, so putting suggestions here: Please post command outputs:
rpm -qa | grep ambari-server
cat /etc/*release
Also it will be good to know which postgres version is avaliable
rpm -qa | grep postgres
I guess it has something to do with python version, but only guess for now...
Upvotes: 1