Skip to content
Snippets Groups Projects
Commit 54df6190 authored by Allen Gilliland's avatar Allen Gilliland
Browse files

shuffle around a few bits of information between admin and install guide and...

shuffle around a few bits of information between admin and install guide and then start to flush out some more details for install guide.
parent d56cd363
No related branches found
No related tags found
No related merge requests found
##Backing up Metabase Application Data
---
###If you're using an Embedded Database
Find the file `metabase.db.h2.db`. If your system is inactive, you can make a copy directly. If your system is active, shut down the Metabase process and make a backup copy of the file. Then, restart the server.
###If you're using Amazon RDS for the Database Application
Enable automated RDS Backups. Instructions can be found [here](http://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_WorkingWithAutomatedBackups.html).
###If you're using a self-managed PostgreSQL or MySQL database
Back up your database as you would to any other PostgreSQL or MySQL database.
## Common Problems
### Startup fails due to Migrations being locked
Sometimes Metabase will fail to startup due to a lingering lock.
Solution:
Run `java -cp metabase-master-2015-08-06-3da1178.jar org.h2.tools.Server -webPort 3000` in the commandline
open the web console (it prints a url)
connect to JDBC URL jdbc:h2:PATH/TO/metabase.db;IFEXISTS=TRUE # note the .h2.db suffix is omitted
blank username, blank password
run `delete from databasechangeloglock;`
kill the h2 server and restart metabase.
......@@ -7,10 +7,8 @@ Are you in charge of managing Metabase for your organization? Then you're in the
* [Enable features that send email (SMTP)](02-setting-up-email.md)
* [Edit your data model](03-data-model.md)
* [Manage user accounts](04-managing-users.md)
* [Backup Metabase application data](05-application-data.md)
* [Configure settings](06-configuration-settings.md)
* [Deal with common problems](07-common-problems.md)
But first, you'll need to install a copy of Metabase if you haven’t already. Our [Installation Guide](../installation-guide/start.md) will help you through the process.
Already done with that? Then let’s start with going over [connecting Metabase to your database](01-managing-databases.md).
\ No newline at end of file
Already done with that? Then let’s start with going over [connecting Metabase to your database](01-managing-databases.md).
# Overview
The Metabase server can be run anywhere that you can run a Java jar. On installation it will have three main portions. First off is the Jar containing the server code. The most recent stable version can be download from [Metabase Downloads](http://wwww.metabase.com/downloads). Next there will need to be a place where Metabase can store persistent data, or its Application Database. Once the server is up and running with a place to store application data, you can connect to one or more Databases.
# Application database
The application database is where metabase stores information about users, their saved questions, dashboards, as well as the semantic model of any underlying databases or data warehouses Metabase is connected to.
By default, Metabase uses an embedded database ([H2](http://www.h2database.com/)).
Often, when running Metabase in production, it is useful to use a another database for ease of administration, backing up the application data and in the case of deployments to AWS or other unreliable instances, to survive instances going down.
To use an alternative database, you can inject database credentials via environment variables. For example
export MB_DB_TYPE=postgres
export MB_DB_DBNAME=metabase
export MB_DB_PORT=5432
export MB_DB_USER=username
export MB_DB_PASS=password
export MB_DB_HOST=localhost
java -jar metabase.jar
would run the application using a local postgres server instead of the default embedded database.
## Backing up the application database
If you use the embedded datbase, the application will create file named "metabase.db.h2.db" in the directory it is being run in. This can be backed up by either stopping the application server and backing up this file. Alternatively to backup the application data while it is running, you can follow the methods described at the relevant [H2 documentation](http://www.h2database.com/html/tutorial.html#upgrade_backup_restore)
If you are using an alternative database, you should back it up using the standard tools for that database.
# Running the server
## Locally
The metabase jar can be run in a number of ways. Simplest is simply to run the jar on any commandline or shell that allows you to run Java programs. It can run on any java platform that supports Java 6 or more recent versions. To check that you have a working java platform, go to a command shell and type
`java -version`
If you see something like
java version "1.60_65"
Java (TM) SE Runtime Environment (build 1.6.0_65-b14-466.1-11M4716)
Java HotSpot (TM) 64-Bit Server VM (build 20.65-b04-466.1, mixed mode)
you're good to go. Otherwise, you should install the Java JDK from [Oracle's Java Downloads page](http://www.oracle.com/technetwork/java/javase/downloads/index.html)
Assuming you have a working JDK, you can now run the jar with a command line of
`java -jar metabase-0.10.0.jar`
(assuming the jar you downloaded is 'metabase-0.10.0.jar')
Note that unless you specified an alternative application database, this will create a file called "metabase.db.h2.db" in the current directory. It is generally advisable to place the jar in its own directory.
Running the jar directly in a shell is typically the first step in trying out Metabase, and can in a pinch be used for a quick and dirty deployment on a shared server. However, if you are going to be running Metabase on an instance connected to the internet, you should use a more hardened deployment model.
## In production
There are a number of ways to run Metabase in production.
### Elastic Beanstalk
See [Elastic Beanstalk Installation Recipe](installing-on-elastic-beanstalk.md) for detailed step by step instructions to install Metabase on Elastic Beanstalk.
### Running in a container
When running on a container, you'll typically want to use a separate database, and pass in the variables. If you wish to store the application database on the container host filesystem, you can using something similar to the below in your docker file:
FROM ubuntu:trusty
ENV LC_ALL C
ENV DEBIAN_FRONTEND noninteractive
ENV DEBCONF_NONINTERACTIVE_SEEN true
ENV MB_JETTY_HOST 0.0.0.0
ENV MB_JETTY_PORT 3000
ENV DB_FILE_NAME /app/files/metabase
VOLUME ["/app/files"]
EXPOSE 3000
RUN apt-get update && \
apt-get install -y openjdk-7-jre
ADD ./metabase-0.10.0.jar /app/
ENTRYPOINT ["java", "-Dlogfile.path=target/log", "-XX:+CMSClassUnloadingEnabled", "-XX:+UseConcMarkSweepGC", "-jar", "/app/metabase-0.10.0.jar"]
### Running the jar using `screen` or as a daemon
If you Know What You're Doing, you can run the jar however it is you usually deploy JVM applications.
### HTTPS!
Regardless of how you deploy Metabase, it is *strongly* recommended that you use HTTPS for all traffic. If you are using Elastic Beanstalk or AWS, we recommend you use ELB and terminate the HTTPS connection there. Otherwise, you can use nginx as a reverse proxy and terminate there.
## Backing up Metabase Application data
If you are using Metabase in a production environment or simply want to make sure you don't lose any of the work that you've done, then backups are what you need.
Metabase uses a single SQL database for all of its runtime application data, so all you need to do is backup that database and you're good to go. From a database back-up you can restore any Metabase installation.
### H2 Embedded Database (default)
If you launched Metabase on a laptop or PC the application will create an embedded H2 database in the directory it is being run in. Navigate to the directory where you started Metabase from and find the file named `metabase.db.h2.db`. Simply copy that file somewhere safe and you are all backed up!
NOTE: If your Metabase is currently running it's best to shut down the Metabase process before making a backup copy of the file. Then, restart the application.
### Amazon RDS for the Database Application
Amazon has its own best practices on how to backup and restore RDS databases, so we'll defer to them. We recommend that you enable automated RDS Backups.
Instructions can be found in the [Amazon RDS User Guide](http://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_WorkingWithAutomatedBackups.html).
### Self-managed PostgreSQL or MySQL database
Simply follow the same instructions you would use for making any normal database backup. It's a large topic more fit for a DBA to answer, but as long as you have a dump of the Metabase database you'll be good to go.
# Install Metabase
* TODO: upload expa ssl certificate to IAM and grab the urn
* Create a new **Application** called *Metabase*
* Inside the *Metabase* **Application**
* Create a new **Application Version** for _metabase-*_ (each new deployed release of Metabase will represent a new version here)
* Create a new **Environment** for *expa-metabase-reserve*
* Follow the detailed instructions on **Creating a New Environment**
* Save the **Environment Configuration**
* NOTE: only do this after the Environment is fully configured and working as desired
* Navigate to the desired **Environment** in the AWS console
* Click on the dropdown for Actions in the upper right corner and select Save Configuration
* Give the configuration a name (e.g. Expa-Metabase-2015May15)
* Click the Save button
* Launch each remaining **Environment** using your saved configuration
* Follow the detailed instructions on **Creating an Environment from a Saved Configuration**
# Creating a New Environment (RDS + ELB/Https)
# Running Metabase on AWS Elastic Beanstalk
### Create a New Application
Elastic Beanstalk is organized into Applications and Environments, so to get started we must create a new Application. This step is easy, so let's just jump in.
Navigate to the AWS Console for Elastic Beanstalk and click on the `Create Application` button.
Use the application name `Metabase` and continue.
Next, create a new Application Version which is what contains the necessary instructions for Elastic Beanstalk to deploy and run the application. If you haven't done so already you can download a ready made Elastic Beanstalk application from our downloads site:
Remember that each application version will represent a new deployment of the application, so its best to give accurate labels here.
### Upload a Server Certificate (optional)
This is only relevant if you plan to use HTTPS (recommended) for your Metabase instance on AWS. There is no requirement to do this, but we are sticklers for security and believe you should always be careful with your data.
Sadly there is no option to do this via the AWS Console, so this step must be performed using the [AWS CLI client](http://docs.aws.amazon.com/cli/latest/userguide/cli-chap-welcome.html)
aws iam upload-server-certificate \
--server-certificate-name <your-cert-name> \
--certificate-body file:///path/to/certificate.crt \
--private-key file:///path/to/private-key.pem
This will create a new certificate inside your AWS environment which can be reused for a variety of things. Remember the name you chose for your certificate because we'll use that later in the setup process when we enable SSL.
### Creating a New Environment (RDS + ELB/Https)
* Prerequisites
* Create an Application
......@@ -94,13 +106,7 @@
* NOTE: your Environment will begin updating with your new change. you will have to wait for this to complete before making additional updates
* IMPORTANT: once this change is made you will no longer be able to access your Metabase instance at the *.elasticbeanstalk.com url provided by Amazon because it will result in a certificate mismatch. To continue accessing your secure Metabase instance you must **Setup DNS CNAME**
# Upload a Server Certificate
* NOTE: There is no option to do this via the AWS Console, so this step must be performed using the AWS CLI
* http://docs.aws.amazon.com/cli/latest/userguide/cli-chap-welcome.html
* aws iam upload-server-certificate --server-certificate-name metabase-dev --certificate-body file://dev.metabase.com.crt --private-key file://dev.metabase.com.pem
# Setup DNS CNAME (using AWS)
### Setup DNS CNAME (using AWS)
* Open up the AWS **Route 53** console by navigating to **Services > Networking > Route 53** in the AWS Console header
* Click on **Hosted Zones** then click on the domain name you want to use for Metabase
* Click on the blue button **Create Record Set** (a new panel will open up on the right side of the page)
......@@ -110,7 +116,7 @@
* Leave all other settings in their default values and click the **Create** button at the bottom of the page
* NOTE: after the record is created you must wait for your change to propagate on the internet. this can take 5-10 minutes, sometimes longer.
# Deploying New Versions
### Deploying New Versions
* Go to Elastic Beanstalk, select the **Metabase** application
* Click on **Application Versions** on the left nav
......@@ -127,4 +133,4 @@
* Select the Environment you wish to deploy the version to using the dropdown list
* Click the **Deploy** button to begin the deployment
* Wait until all deployment activities are completed, then verify the deployment by accessing the application url
* NOTE: once a new version is deployed you can safely delete the old Application Version if desired. we recommend keeping at least one previous version available for a while in case you desire to revert for any reason.
\ No newline at end of file
* NOTE: once a new version is deployed you can safely delete the old Application Version if desired. we recommend keeping at least one previous version available for a while in case you desire to revert for any reason.
### Running Metabase on Docker
When running on a container, you'll typically want to use a separate database, and pass in the variables. If you wish to store the application database on the container host filesystem, you can using something similar to the below in your docker file:
FROM ubuntu:trusty
ENV LC_ALL C
ENV DEBIAN_FRONTEND noninteractive
ENV DEBCONF_NONINTERACTIVE_SEEN true
ENV MB_JETTY_HOST 0.0.0.0
ENV MB_JETTY_PORT 3000
ENV DB_FILE_NAME /app/files/metabase
VOLUME ["/app/files"]
EXPOSE 3000
RUN apt-get update && \
apt-get install -y openjdk-7-jre
ADD ./metabase-0.10.0.jar /app/
ENTRYPOINT ["java", "-Dlogfile.path=target/log", "-XX:+CMSClassUnloadingEnabled", "-XX:+UseConcMarkSweepGC", "-jar", "/app/metabase-0.10.0.jar"]
# Running the Metabase Jar File
To run the Metabase jar file you need to have Java installed on your system. Currently Metabase requires Java 6 or higher and will work on either the OpenJDK or Oracle JDK. Note that the Metabase team prefers to stick with open source solutions where possible, so we use the OpenJDK for our Metabase instances.
### Verify Java is installed
Before you can do anything you must verify that you have Java installed. To check that you have a working java runtime, go to a terminal and type:
java -version
You should see output such as:
java version "1.60_65"
Java (TM) SE Runtime Environment (build 1.6.0_65-b14-466.1-11M4716)
Java HotSpot (TM) 64-Bit Server VM (build 20.65-b04-466.1, mixed mode)
If you did not see the output above and instead saw either an error or your Java version is less than 1.6, then you need to install the Java JDK.
[OpenJDK Downloads](http://openjdk.java.net/install/)
[Oracle's Java Downloads](http://www.oracle.com/technetwork/java/javase/downloads/index.html)
### Launching Metabase
Now that you have a working JDK, you can now run the jar from a terminal with:
java -jar metabase-standalone.jar
It's that simple. This will start the Metabase application using all of the default settings. You should see some log entries starting to run in your terminal window showing you the application progress as it starts up. Once Metabase is fully started you'll see a confirmation such as:
Metabase successfully started
At this point your ready to go! You can access your new Metabase server on port 3000, most likely at [localhost:3000](http://localhost:3000)
Note that in the default configuration Metabase will use a local H2 database for storing all its own application data. This is meant for simple evaluations or personal installations, but if you are running Metabase for a team we recommend you upgrade to a more robust SQL server such as Postgres. Continue reading for details on how to do that.
### The Metabase Application Database
The application database is where Metabase stores information about users, saved questions, dashboards, and any other data needed to run the application. The default settings use an H2 database, but other options are available.
#### [H2](http://www.h2database.com/) (default)
To use the H2 database for your Metabase instance you don't need to do anything at all. When the application is first launched it will attempt to create a new H2 database in the same filesystem location the application is launched from.
You can see these database files from the terminal:
ls metabase.*
You should see the following files:
metabase.db.h2.db
If for any reason you want to use an H2 database file in a separate location from where you launch Metabase you can do so using an environment variable. For example:
export MB_DB_TYPE=h2
export MB_DB_FILE=/the/path/to/my/h2.db
java -jar metabase-standalone.jar
#### [Postgres](http://www.postgresql.org/)
For production installations of Metabase we recommend that users replace the H2 database with Postgres. This offers a greater degree of performance and reliability when Metabase is running with many users.
You can change the application database to use Postgres using a few simple environment variables. For example:
export MB_DB_TYPE=postgres
export MB_DB_DBNAME=metabase
export MB_DB_PORT=5432
export MB_DB_USER=<username>
export MB_DB_PASS=<password>
export MB_DB_HOST=localhost
java -jar metabase-standalone.jar
This will tell Metabase to look for its application database using the supplied Postgres connection information.
NOTE: you cannot change the application database while the application is running. these values are read only once when the application starts up and will remain constant throughout the running of the application.
NOTE: currently Metabase does not support migrating data from one application database to another, so if you start with H2 and then want to move to Postgres you'll have to dump the data from H2 and import it into Postgres before relaunching the application.
**This guide will teach you:**
> [How to install Metabase](01-overview.md)
> [How to install Metabase](#installing-metabase)
> [Tips for troubleshooting various issues](#troubleshooting-metabase)
> [Common customizations](#customizing-metabase)
> [How to run Metabase](02-running-metabase.md)
> [Connecting to database](03-connecting-databases.md)
\ No newline at end of file
# <a name="installing-metabase"></a>Installing and Running Metabase
Metabase is built and packaged as a Java jar file and can be run anywhere that Java is available. Below we provide detailed instructions on how to install and run Metabase in a variety of common configurations.
#### [Running the Jar File](running-the-metabase-jar-file.md)
This is the simplest and most basic way of running Metabase. Here we'll cover the general requirements for running Metabase and provide some information about how to customize your installation for any scenario.
#### [Running the Mac Application](running-the-metabase-mac-app.md)
Metabase provides a binary Mac OS X application for users who are interested in trying Metabase on a Mac system.
#### [Running on Docker](running-metabase-on-docker.md)
If you are using Docker containers and prefer to manage your Metabase installation that way then we've got you covered. This guide discusses how to use the Metabase Docker image to launch a container running Metabase.
### Cloud Platforms
#### [Running on AWS Elastic Beanstalk](installing-on-elastic-beanstalk.md)
Step-by-step instructions on how to deploy Metabase on Elastic Beanstalk using RDS. This is the most common way to run Metabase in production.
#### [Running on Heroku](running-metabase-on-heroku.md)
Currently in beta. We've run Metabase on Heroku and it works just fine, but it's not hardened for production use just yet.
# <a name="troubleshooting-metabase"></a>Troubleshooting Common Problems
### Metabase fails to startup
Sometimes Metabase will fail to complete its startup due to a database lock that was not cleared properly.
Solution:
Go to a terminal and run `java -jar metabase-standalone.jar migrations release-locks` in the command line to manually clear the locks. Then restart your Metabase instance.
# <a name="customizing-metabase"></a>Custom Options
#### HTTPS Support
Regardless of how you deploy Metabase, it is *strongly* recommended that you use HTTPS for all traffic. If you are using Elastic Beanstalk or AWS, we recommend you use ELB and terminate the HTTPS connection there. Otherwise, you can use nginx as a reverse proxy and terminate there.
#### [Manually running Database Migrations](manually-running-metabase-migrations.md)
If you prefer to have full control over the executing of database schema changes then you'll want to read about Metabase's database migrations and how to run them manually.
#### [Backing up your Metabase](backing-up-the-metabase-database.md)
Better safe than sorry we always say. Simple instructions to help with backing up a Metabase instance.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment