Merge branch '8784-dir-listings'
[arvados.git] / doc / install / install-postgresql.html.textile.liquid
1 ---
2 layout: default
3 navsection: installguide
4 title: Set up PostgreSQL databases
5 ...
6 {% comment %}
7 Copyright (C) The Arvados Authors. All rights reserved.
8
9 SPDX-License-Identifier: CC-BY-SA-3.0
10 {% endcomment %}
11
12 Two Arvados Rails servers store data in a PostgreSQL database: the SSO server, and the API server.  The API server requires at least version 9.1 of PostgreSQL.  Beyond that, you have the flexibility to deploy PostgreSQL any way that the Rails servers will be able to connect to it.  Our recommended deployment strategy is:
13
14 * Install PostgreSQL on the the same host as the SSO server, and dedicate that install to hosting the SSO database.  This provides the best security for the SSO server, because the database does not have to accept any client connections over the network.  Typical load on the SSO server is light enough that deploying both it and its database on the same host does not compromise performance.
15 * If you want to provide the most scalability for your Arvados cluster, install PostgreSQL for the API server on a dedicated host.  This gives you the most flexibility to avoid resource contention, and tune performance separately for the API server and its database.  If performance is less of a concern for your installation, you can install PostgreSQL on the API server host directly, as with the SSO server.
16
17 Find the section for your distribution below, and follow it to install PostgreSQL on each host where you will deploy it.  Then follow the steps in the later section(s) to set up PostgreSQL for the Arvados service(s) that need it.
18
19 h2(#centos7). Install PostgreSQL on CentOS 7
20
21 # Install PostgreSQL:
22   <notextile><pre>~$ <span class="userinput">sudo yum install postgresql-server</span></pre></notextile>
23 # Initialize the database:
24   <notextile><pre>~$ <span class="userinput">sudo postgresql-setup initdb</span></pre></notextile>
25 # Configure the database to accept password connections:
26   <notextile><pre><code>~$ <span class="userinput">sudo sed -ri -e 's/^(host +all +all +(127\.0\.0\.1\/32|::1\/128) +)ident$/\1md5/' /var/lib/pgsql/data/pg_hba.conf</span></code></pre></notextile>
27 # Configure the database to launch at boot:
28   <notextile><pre>~$ <span class="userinput">sudo systemctl enable postgresql</span></pre></notextile>
29 # Start the database:
30   <notextile><pre>~$ <span class="userinput">sudo systemctl start postgresql</span></pre></notextile>
31 # "Set up Arvados credentials and databases":#rails_setup for the services that will use this PostgreSQL install.
32
33 h2(#debian). Install PostgreSQL on Debian or Ubuntu
34
35 # Install PostgreSQL:
36   <notextile><pre>~$ <span class="userinput">sudo apt-get install postgresql</span></pre></notextile>
37 # "Set up Arvados credentials and databases":#rails_setup for the services that will use this PostgreSQL install.
38
39 <a name="rails_setup"></a>
40
41 h2(#sso). Set up SSO server credentials and database
42
43 {% assign service_role = "arvados_sso" %}
44 {% assign service_database = "arvados_sso_production" %}
45 {% include 'install_postgres_database' %}
46
47 h2(#api). Set up API server credentials and database
48
49 {% assign service_role = "arvados" %}
50 {% assign service_database = "arvados_production" %}
51 {% include 'install_postgres_database' %}