docs-v2/content/influxdb/v2/install/_index.md

31 KiB
Raw Permalink Blame History

title description menu weight influxdb/v2/tags related
Install InfluxDB Download, install, and set up InfluxDB OSS. influxdb_v2 2
install
/influxdb/v2/reference/cli/influx/auth/
/influxdb/v2/reference/cli/influx/config/
/influxdb/v2/reference/cli/influx/
/influxdb/v2/admin/tokens/

The InfluxDB v2 time series platform is purpose-built to collect, store, process and visualize metrics and events.

  1. Download and install InfluxDB v2.

    {{< tabs-wrapper >}} {{% tabs %}} macOS Linux Windows Docker Kubernetes Raspberry Pi {{% /tabs %}}

{{% tab-content %}}

To install InfluxDB, do one of the following:

{{% note %}} We recommend using Homebrew to install InfluxDB v2 on macOS. {{% /note %}}

{{% note %}}

InfluxDB and the influx CLI are separate packages

The InfluxDB server (influxd) and the influx CLI are packaged and versioned separately.

You'll install the influx CLI in a later step.

{{% /note %}}

Install using Homebrew

brew update
brew install influxdb

{{% note %}} Homebrew also installs influxdb-cli as a dependency. For information about using the influx CLI, see the influx CLI reference documentation. {{% /note %}}

Manually download and install for macOS

  1. In your browser or your terminal, download the InfluxDB package.

    InfluxDB v2 (macOS)

    # Download using cURL
    curl -O https://dl.influxdata.com/influxdb/releases/influxdb2-{{< latest-patch >}}_darwin_amd64.tar.gz \
     --output-dir ~/Downloads
    
  2. Unpackage the InfluxDB binary.

    Do one of the following:

    • In Finder, double-click the downloaded package file.

    • In your terminal (for example, Terminal or iTerm2), use tar to unpackage the file--for example, enter the following command to extract it into the current directory:

      # Unpackage contents to the current working directory
      tar zxvf ~/Downloads/influxdb2-{{< latest-patch >}}_darwin_amd64.tar.gz
      
  3. Optional: Place the influxd binary in your $PATH--for example, copy the binary to /usr/local/bin:

    # (Optional) Copy the influxd binary to your $PATH
    sudo cp influxdb2-{{< latest-patch >}}/influxd /usr/local/bin/
    

    With the influxd binary in your $PATH (/usr/local/bin), you can enter influxd in your terminal to start the server.

    If you choose not to move the influxd binary into your $PATH, enter the path to the binary to start the server--for example:

    ./influxdb2-{{< latest-patch >}}/influxd
    

{{< expand-wrapper >}} {{% expand "Recommended Set appropriate directory permissions" %}}

To prevent unwanted access to data, set the permissions on the influxdb data-dir to not be world readable. If installing on a server, set a umask of 0027 to properly permission all newly created files--for example, enter the following command in your terminal:

chmod 0750 ~/.influxdbv2

{{% /expand %}} {{% expand "Recommended Verify the authenticity of the downloaded binary" %}}

For added security, use gpg to verify the signature of your download. (Most operating systems include the gpg command by default. If gpg is not available, see the GnuPG homepage for installation instructions.)

  1. Download and import InfluxData's public key. gpg --import outputs to stderr. The following example shows how to import the key, redirect the output to stdout, and then check for the expected key name:

    curl -s https://repos.influxdata.com/influxdata-archive_compat.key \
     | gpg --import - 2>&1 \
     | grep 'InfluxData Package Signing Key <support@influxdata.com>'
    

    If successful, the output is similar to the following:

    gpg: key D8FF8E1F7DF8B07E: public key "InfluxData Package Signing Key <support@influxdata.com>" imported
    
  2. Download the signature file for the release by adding .asc to the download URL, and then use gpg to verify the download signature--for example:

    curl -s https://dl.influxdata.com/influxdb/releases/influxdb2-{{< latest-patch >}}_darwin_amd64.tar.gz.asc \
    | gpg --verify - ~/Downloads/influxdb2-{{< latest-patch >}}_darwin_amd64.tar.gz \
    2>&1 | grep 'InfluxData Package Signing Key <support@influxdata.com>'
    

    If successful, the output is the following:

    gpg: Good signature from "InfluxData Package Signing Key <support@influxdata.com>" [unknown]
    

{{% /expand %}} {{< /expand-wrapper >}}

{{% note %}} Both InfluxDB 1.x and 2.x have associated influxd and influx binaries. If InfluxDB 1.x binaries are already in your $PATH, run the v2 binaries in place or rename them before putting them in your $PATH. If you rename the binaries, all references to influxd and influx in this documentation refer to your renamed binaries. {{% /note %}}

{{% /tab-content %}}

{{% tab-content %}}

To install {{% product-name %}} on Linux, do one of the following:

{{% note %}}

InfluxDB and the influx CLI are separate packages

The InfluxDB server (influxd) and the influx CLI are packaged and versioned separately.

You'll install the influx CLI in a later step.

{{% /note %}}

Install InfluxDB as a service with systemd

  1. Download and install the appropriate .deb or .rpm file using a URL from the InfluxData downloads page with the following commands:

    # Ubuntu/Debian AMD64
    curl -O https://dl.influxdata.com/influxdb/releases/influxdb2_{{< latest-patch >}}-1_amd64.deb
    sudo dpkg -i influxdb2_{{< latest-patch >}}-1_amd64.deb
    
    # Ubuntu/Debian ARM64
    curl -O https://dl.influxdata.com/influxdb/releases/influxdb2_{{< latest-patch >}}-1_arm64.deb
    sudo dpkg -i influxdb2_{{< latest-patch >}}-1_arm64.deb
    
    # Red Hat/CentOS/Fedora x86-64 (x64, AMD64)
    curl -O https://dl.influxdata.com/influxdb/releases/influxdb2-{{< latest-patch >}}-1.x86_64.rpm
    sudo yum localinstall influxdb2-{{< latest-patch >}}-1.x86_64.rpm
    
    # Red Hat/CentOS/Fedora AArch64 (ARMv8-A)
    curl -O https://dl.influxdata.com/influxdb/releases/influxdb2-{{< latest-patch >}}-1.aarch64.rpm
    sudo yum localinstall influxdb2-{{< latest-patch >}}-1.aarch64.rpm
    
  2. Start the InfluxDB service:

    sudo service influxdb start
    

    Installing the InfluxDB package creates a service file at /lib/systemd/system/influxdb.service to start InfluxDB as a background service on startup.

  3. To verify that the service is running correctly, restart your system and then enter the following command in your terminal:

    sudo service influxdb status
    

    If successful, the output is the following:

    ● influxdb.service - InfluxDB is an open-source, distributed, time series database
       Loaded: loaded (/lib/systemd/system/influxdb.service; enabled; vendor preset: enable>
       Active: active (running)
    

For information about where InfluxDB stores data on disk when running as a service, see File system layout.

Pass configuration options to the service

You can use systemd to customize InfluxDB configuration options and pass them to the InfluxDB service.

  1. Edit the /etc/default/influxdb2 service configuration file to assign configuration directives to influxd command line flags--for example, add one or more <ENV_VARIABLE_NAME>=<COMMAND_LINE_FLAG> lines like the following:

    ARG1="--http-bind-address :8087"
    ARG2="--storage-wal-fsync-delay=15m"
    
    
  2. Edit the /lib/systemd/system/influxdb.service file to pass the variables to the ExecStart value:

    ExecStart=/usr/bin/influxd $ARG1 $ARG2
    

Manually download and install the influxd binary

  1. In your browser or your terminal, download the InfluxDB binary for your system architecture (AMD64 or ARM).

    InfluxDB v2 (amd64) InfluxDB v2 (arm)

    # Use curl to download the amd64 binary.
    curl -O https://dl.influxdata.com/influxdb/releases/influxdb2-{{< latest-patch >}}_linux_amd64.tar.gz
    
    # Use curl to download the arm64 binary.
    curl -O https://dl.influxdata.com/influxdb/releases/influxdb2-{{< latest-patch >}}_linux_arm64.tar.gz
    
  2. Extract the downloaded binary.

    Note: The following commands are examples. Adjust the filenames, paths, and utilities if necessary.

    # amd64
    tar xvzf ./influxdb2-{{< latest-patch >}}_linux_amd64.tar.gz
    
    # arm64
    tar xvzf ./influxdb2-{{< latest-patch >}}_linux_arm64.tar.gz
    
  3. Optional: Place the extracted influxd executable binary in your system $PATH.

    # amd64
    sudo cp ./influxdb2-{{< latest-patch >}}/usr/bin/influxd /usr/local/bin/
    
    # arm64
    sudo cp ./influxdb2-{{< latest-patch >}}/usr/bin/influxd /usr/local/bin/
    

    If you choose to not move the influxd binary into your $PATH, enter the path to the binary to start the server--for example:

    ./influxdb2-{{< latest-patch >}}/usr/bin/influxd
    

{{< expand-wrapper >}} {{% expand "Recommended Set appropriate directory permissions" %}}

To prevent unwanted access to data, set the permissions on the influxdb data-dir to not be world readable. If installing on a server, we recommend setting a umask of 0027 to properly permission all newly created files. To set umask, use a UMask directive in a systemd unit file or run Influxdb as a specific user that has the umask properly set--for example, enter the following command in your terminal:

chmod 0750 ~/.influxdbv2

{{% /expand %}} {{% expand "Recommended Verify the authenticity of downloaded binary" %}}

For added security, use gpg to verify the signature of your download. (Most operating systems include the gpg command by default. To install gpg, see the GnuPG installation instructions).

  1. Download and import InfluxData's public key. gpg --import outputs to stderr. The following example shows how to import the key, redirect the output to stdout, and then check for the expected key name:

    curl -s https://repos.influxdata.com/influxdata-archive_compat.key \
    | gpg --import - 2>&1 \
    | grep 'InfluxData Package Signing Key <support@influxdata.com>'
    

    If successful, the output is similar to the following:

    gpg: key D8FF8E1F7DF8B07E: public key "InfluxData Package Signing Key <support@influxdata.com>" imported
    
  2. Download the signature file for the release by adding .asc to the download URL, and then use gpg to verify the download signature--for example:

    curl -s https://dl.influxdata.com/influxdb/releases/influxdb2-{{< latest-patch >}}_linux_amd64.tar.gz.asc \
    | gpg --verify - influxdb2-{{< latest-patch >}}_linux_amd64.tar.gz \
    2>&1 | grep 'InfluxData Package Signing Key <support@influxdata.com>'
    

    If successful, the output is the following:

    gpg: Good signature from "InfluxData Package Signing Key <support@influxdata.com>" [unknown]
    

{{% /expand %}} {{< /expand-wrapper >}}

{{% /tab-content %}}

{{% tab-content %}}

System requirements

{{% note %}}

Command line examples

Use Powershell or WSL to execute influx and influxd commands. The command line examples in this documentation use influx and influxd as if installed on the system PATH. If these binaries are not installed on your PATH, replace influx and influxd in the provided examples with ./influx and ./influxd respectively. {{% /note %}}

{{% note %}}

InfluxDB and the influx CLI are separate packages

The InfluxDB server (influxd) and the influx CLI are packaged and versioned separately.

You'll install the influx CLI in a later step.

{{% /note %}}

InfluxDB v2 (Windows)

Expand the downloaded archive into C:\Program Files\InfluxData\ and rename the files if desired.

Expand-Archive .\influxdb2-{{< latest-patch >}}-windows.zip -DestinationPath 'C:\Program Files\InfluxData\'
mv 'C:\Program Files\InfluxData\influxdb2-{{< latest-patch >}}' 'C:\Program Files\InfluxData\influxdb'

{{< expand-wrapper >}} {{% expand "Recommended Set appropriate directory permissions" %}}

To prevent unwanted access to data, we recommend setting the permissions on the influxdb data-dir to not be world readable--for example: enter the following commands in your terminal:

$acl = Get-Acl "C:\Users\<username>\.influxdbv2"
$accessRule = New-Object System.Security.AccessControl.FileSystemAccessRule("everyone","Read","Deny")
$acl.SetAccessRule($accessRule)
$acl | Set-Acl "C:\Users\<username>\.influxdbv2"

{{% /expand %}} {{< /expand-wrapper >}}

{{% /tab-content %}}

{{% tab-content %}}

Install and set up InfluxDB in a container

The following guide uses Docker CLI commands to set Docker and InfluxDB options, but you can also use Dockerfiles and Docker Compose.

  1. Follow instructions to install Docker Desktop for your system.

  2. Start a Docker container from the influxdb Docker Hub image--for example, in your terminal, enter the docker run influxdb:2 command with command line flags for initial setup options and file system mounts.

    The following example uses the Docker --mount option to persist InfluxDB configuration and data to volumes. Persisting your data to a file system outside the container ensures that your data isn't deleted if you delete the container.

    docker run \
     --name influxdb2 \
     --publish 8086:8086 \
     --mount type=volume,source=influxdb2-data,target=/var/lib/influxdb2 \
     --mount type=volume,source=influxdb2-config,target=/etc/influxdb2 \
     --env DOCKER_INFLUXDB_INIT_MODE=setup \
     --env DOCKER_INFLUXDB_INIT_USERNAME=<USERNAME> \
     --env DOCKER_INFLUXDB_INIT_PASSWORD=<PASSWORD> \
     --env DOCKER_INFLUXDB_INIT_ORG=<ORG_NAME> \
     --env DOCKER_INFLUXDB_INIT_BUCKET=<BUCKET_NAME> \
     influxdb:2
    

    The command passes the following arguments:

    • --publish 8086:8086: Exposes the InfluxDB UI and HTTP API on the host's 8086 port.
    • --mount type=volume,source=influxdb2-data,target=/var/lib/influxdb2: Creates a volume named influxdb2-data mapped to the InfluxDB data directory to persist data outside the container.
    • --mount type=volume,source=influxdb2-config,target=/etc/influxdb2: Creates a volume named influxdb2-config mapped to the InfluxDB configuration directory to make configurations available outside the container.
    • -e DOCKER_INFLUXDB_INIT_MODE=setup: Environment variable that invokes the automated setup of the initial organization, user, bucket, and token when creating the container.
    • -e DOCKER_INFLUXDB_INIT_<SETUP_OPTION>: Environment variables for initial setup options--replace the following with your own values:
      • <USERNAME>: The username for the initial user--an admin user with an API Operator token.
      • <PASSWORD>: The password for the initial user.
      • <ORG_NAME>: The name for the initial organization.
      • <BUCKET_NAME>: The name for the initial bucket.

    For more options, see the influxdb Docker Hub image documentation. If you don't specify InfluxDB initial setup options, you can set up manually later using the UI or CLI in a running container.

If successful, the command starts InfluxDB initialized with the user, organization, bucket, and Operator token, and logs to stdout. You can view the Operator token in the /etc/influxdb2/influx-configs file and use it to authorize creating an All Access token.

To run the InfluxDB container in detached mode, include the --detach flag in the docker run command.

Run InfluxDB CLI commands in a container

When you start a container using the influxdb Docker Hub image, it also installs the influx CLI in the container. With InfluxDB setup and running in the container, you can use the Docker CLI docker exec command to interact with the influx and influxd CLIs inside the container.

To use the influx CLI in the container, run docker exec -it <CONTAINER_NAME> influx <COMMAND>--for example:

# List CLI configurations
docker exec -it influxdb2 influx config ls
# View the server configuration
docker exec -it influxdb2 influx server-config
# Inspect server details
docker exec -it influxdb2 influxd inspect -d

Manage files in mounted volumes

To copy files, such as the InfluxDB server config.yml file, between your local file system and a volume, use the docker container cp command.

{{% /tab-content %}}

{{% tab-content %}}

Install InfluxDB in a Kubernetes cluster

The instructions below use minikube or kind, but the steps should be similar in any Kubernetes cluster. InfluxData also makes Helm charts available.

  1. Install minikube or kind.

  2. Start a local cluster:

    # with minikube
    minikube start
    
    # with kind
    kind create cluster
    
  3. Apply the sample InfluxDB configuration by running:

    kubectl apply -f https://raw.githubusercontent.com/influxdata/docs-v2/master/static/downloads/influxdb-k8-minikube.yaml
    

    This creates an influxdb Namespace, Service, and StatefulSet. A PersistentVolumeClaim is also created to store data written to InfluxDB.

    Important: Always inspect YAML manifests before running kubectl apply -f <url>!

  4. Ensure the Pod is running:

    kubectl get pods -n influxdb
    
  5. Ensure the Service is available:

    kubectl describe service -n influxdb influxdb
    

    You should see an IP address after Endpoints in the command's output.

  6. Forward port 8086 from inside the cluster to localhost:

    kubectl port-forward -n influxdb service/influxdb 8086:8086
    

{{% /tab-content %}}

{{% tab-content %}}

Requirements

To run InfluxDB on Raspberry Pi, you need:

  • a Raspberry Pi 4+ or 400
  • a 64-bit operating system. We recommend installing a 64-bit version of Ubuntu of Ubuntu Desktop or Ubuntu Server compatible with 64-bit Raspberry Pi.

Install Linux binaries

Follow the Linux installation instructions to install InfluxDB on a Raspberry Pi.

Monitor your Raspberry Pi

Use the InfluxDB Raspberry Pi template to easily configure collecting and visualizing system metrics for the Raspberry Pi.

Monitor 32-bit Raspberry Pi systems

If you have a 32-bit Raspberry Pi, use Telegraf to collect and send data to:

  • InfluxDB OSS, running on a 64-bit system
  • InfluxDB Cloud with a Free Tier account
  • InfluxDB Cloud with a paid Usage-Based account with relaxed resource restrictions.

{{% /tab-content %}}

{{< /tabs-wrapper >}}

  1. Start InfluxDB.

    If it isn't already running, follow the instructions to start InfluxDB on your system:

    {{< tabs-wrapper >}} {{% tabs %}} macOS Linux Windows Docker Kubernetes {{% /tabs %}}

{{% tab-content %}}

To start InfluxDB, run the influxd daemon:

influxd

(macOS Catalina and newer) Authorize the influxd binary

macOS requires downloaded binaries to be signed by registered Apple developers. Currently, when you first attempt to run influxd, macOS will prevent it from running.

To manually authorize the influxd binary, follow the instructions for your macOS version to allow downloaded applications.

Run InfluxDB on macOS Ventura
  1. Follow the preceding instructions to attempt to start influxd.
  2. Open System Settings and click Privacy & Security.
  3. Under the Security heading, there is a message about "influxd" being blocked, click Allow Anyway.
  4. When prompted, enter your password to allow the setting.
  5. Close System Settings.
  6. Attempt to start influxd.
  7. A prompt appears with the message "macOS cannot verify the developer of "influxd"..."". Click Open.
Run InfluxDB on macOS Catalina
  1. Attempt to start influxd.
  2. Open System Preferences and click Security & Privacy.
  3. Under the General tab, there is a message about influxd being blocked. Click Open Anyway.

We are in the process of updating the build process to ensure released binaries are signed by InfluxData.

{{% warn %}}

"too many open files" errors

After running influxd, you might see an error in the log output like the following:

too many open files

To resolve this error, follow the recommended steps to increase file and process limits for your operating system version then restart influxd.

{{% /warn %}}

{{% /tab-content %}}

{{% tab-content %}}

If InfluxDB was installed as a systemd service, systemd manages the influxd daemon and no further action is required. If the binary was manually downloaded and added to the system $PATH, start the influxd daemon with the following command:

influxd

{{% /tab-content %}}

{{% tab-content %}}

In Powershell, navigate into C:\Program Files\InfluxData\influxdb and start InfluxDB by running the influxd daemon:

cd -Path 'C:\Program Files\InfluxData\influxdb'
./influxd

{{% note %}}

Grant network access

When starting InfluxDB for the first time, Windows Defender appears with the following message:

Windows Defender Firewall has blocked some features of this app.

  1. Select Private networks, such as my home or work network.
  2. Click Allow access. {{% /note %}}

{{% /tab-content %}}

{{% tab-content %}}

To use the Docker CLI to start an existing container, enter the following command:

docker start influxdb2

Replace influxdb2 with the name of your container.

To start a new container, follow instructions to install and set up InfluxDB in a container.

{{% /tab-content %}}

{{% tab-content %}}

To start InfluxDB using Kubernetes, follow instructions to install InfluxDB in a Kubernetes cluster.

{{% /tab-content %}} {{< /tabs-wrapper >}}

If successful, you can view the InfluxDB UI at http://localhost:8086.

InfluxDB starts with default settings, including the following:

  • http-bind-address=:8086: Uses port 8086 (TCP) for InfluxDB UI and HTTP API client-server communication.
  • reporting-disabled=false: Sends InfluxDB telemetry information back to InfluxData.

To override default settings, specify configuration options when starting InfluxDB--for example:

{{< expand-wrapper >}} {{% expand "Configure the port or address" %}} By default, the InfluxDB UI and HTTP API use port 8086.

To specify a different port or address, override the http-bind-address option when starting influxd--for example:

{{< code-tabs-wrapper >}} {{% code-tabs %}} Linux Windows Powershell {{% /code-tabs %}} {{% code-tab-content %}}

influxd --http-bind-address

{{% /code-tab-content %}} {{% code-tab-content %}}

./influxd --http-bind-address

{{% /code-tab-content %}} {{< /code-tabs-wrapper >}} {{% /expand %}}

{{% expand "Opt-out of telemetry reporting" %}}

By default, InfluxDB sends telemetry data back to InfluxData. The InfluxData telemetry page provides information about what data is collected and how it is used.

To opt-out of sending telemetry data back to InfluxData, specify the reporting-disabled option when starting influxd--for example:

{{< code-tabs-wrapper >}} {{% code-tabs %}} Linux Windows Powershell {{% /code-tabs %}} {{% code-tab-content %}}

influxd --reporting-disabled

{{% /code-tab-content %}} {{% code-tab-content %}}

./influxd --reporting-disabled

{{% /code-tab-content %}} {{< /code-tabs-wrapper >}} {{% /expand %}} {{< /expand-wrapper >}}

For information about InfluxDB v2 default settings and how to override them, see InfluxDB configuration options.

  1. {{< req text="Recommended:" color="magenta" >}} Download, install, and configure the influx CLI.

    We recommend installing the influx CLI, which provides a simple way to interact with InfluxDB from a command line. For detailed installation and setup instructions, see Use the influx CLI.

    {{% note %}}

InfluxDB and the influx CLI are separate packages

The InfluxDB server (influxd) and the influx CLI are packaged and versioned separately. Some install methods (for example, the InfluxDB Docker Hub image) include both.

{{% /note %}}

With InfluxDB installed and initialized, get started writing and querying data.