You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Ubuntu安装Ambari 2.4时PostgreSQL相关问题求助

Fixing Ambari 2.4 Installation on Ubuntu with Manually Installed PostgreSQL

Hey there! I’ve helped folks work through this exact issue before—since you’ve already got PostgreSQL up and running on your Ubuntu system, we just need to get Ambari configured to use it instead of relying on its default database setup. Here’s how to do it step by step:

Step 1: Create a Dedicated Database & User for Ambari

First, we need to set up a PostgreSQL database and user that Ambari can use exclusively. Run these commands:

  1. Access the PostgreSQL shell:
    sudo -u postgres psql
    
  2. Inside the shell, create the database, user, and grant full permissions:
    CREATE DATABASE ambari;
    CREATE USER ambari WITH PASSWORD 'your_secure_password_here';
    GRANT ALL PRIVILEGES ON DATABASE ambari TO ambari;
    
  3. Exit the shell with:
    \q
    

Step 2: Install & Configure PostgreSQL JDBC Driver for Ambari

Ambari needs the JDBC driver to connect to your PostgreSQL instance. Install it via apt and copy it to Ambari’s resource directory:

sudo apt-get update && sudo apt-get install -y libpq-java
sudo cp /usr/share/java/postgresql.jar /var/lib/ambari-server/resources/

Step 3: Configure Ambari Server to Use External PostgreSQL

Now tell Ambari to use your PostgreSQL database instead of its default setup:

  1. First, link the JDBC driver to Ambari:
    sudo ambari-server setup --jdbc-db=postgres --jdbc-driver=/var/lib/ambari-server/resources/postgresql.jar
    
  2. Run the main Ambari setup command:
    sudo ambari-server setup
    
    When prompted, select Advanced Database Configuration, then fill in these details:
    • Database Type: PostgreSQL
    • Database Host: localhost (use your remote server IP if PostgreSQL is on another machine)
    • Database Name: ambari
    • Database User: ambari
    • Database Password: The secure password you set in Step 1

Step 4: Initialize Ambari’s Database Schema

We need to populate the ambari database with all the tables and data Ambari requires:

  1. Reset Ambari’s database configuration:
    sudo ambari-server reset --database
    
  2. Import Ambari’s PostgreSQL schema into your database:
    sudo -u postgres psql -d ambari -f /var/lib/ambari-server/resources/Ambari-DDL-Postgres-CREATE.sql
    

Step 5: Start Ambari Server & Verify

Finally, start the Ambari server and check if it loads correctly:

sudo ambari-server start

Head over to http://your-server-ip:8080 in your browser—you should see the Ambari setup wizard load without any database-related errors.

Quick Troubleshooting Tips

  • Make sure PostgreSQL is running: sudo systemctl status postgresql (start it with sudo systemctl start postgresql if it’s stopped)
  • Double-check that the ambari user has full permissions on the ambari database
  • Ensure the default PostgreSQL port (5432) is open locally if you’re using localhost

内容的提问来源于stack exchange,提问作者Ishan Kumar

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.19 08:26:20