Install Confluent CLI

Install

The Confluent CLI is included in the full Confluent Platform installation packages.

Updates using the confluent update command are disabled for the CLI included in the full Confluent Platform packages to ensure compatibility. See Install alternative version in Confluent Platform packages for upgrading to a higher version of CLI using a script.

Confluent Community software users must download the CLI separately and configure it to point at their installation manually.

Important

When you separately download and install Confluent CLI, ensure you are installing a Confluent CLI version that is compatible with the version of Confluent Platform you are running. The latest version of Confluent CLI may not be compatible with the version of Confluent Platform you are running. For reference, see the Confluent CLI to Confluent Platform compatibility table.

Supported environments

The Confluent CLI is supported for macOS, Microsoft Windows, and Linux (including Alpine) operating systems.

Scripted installation

Note

On Microsoft Windows, an appropriate Linux environment may need to be installed in order to have the curl and sh commands available, such as the Windows Subsystem for Linux.

  1. List all available Confluent CLI versions:

    curl -sL --http1.1 https://cnfl.io/cli | sh -s -- -l
    
  2. Download a specific version listed in the above output list.

    The script detects which system is running and downloads the appropriate binary.

    • To download and install Confluent CLI in the default directory, ./bin:

      curl -sL --http1.1 https://cnfl.io/cli | sh -s -- <version>
      

      For example, to download the 1.36.0 version:

      curl -sL --http1.1 https://cnfl.io/cli | sh -s -- v1.36.0
      
    • To download and install Confluent CLI in a custom directory of your choice, specify -b and a custom directory path, <custom-path-to-cli>.

      curl -sL --http1.1 https://cnfl.io/cli | sh -s -- v1.36.0 -b <path-to-cli>
      

      The <custom-path-to-cli> must be in your PATH.

      Note the OS and architecture in use. For example, on macOS, the previous script results in the following terminal output indicating the machine’s appropriate binary is for the darwin operating system type and amd64 architecture type:

      confluentinc/cli info found version: v1.36.0 for v1.36.0/darwin/amd64
      
  3. Set the PATH environment to include the directory that you downloaded the CLI binaries in the previous step.

  4. Optionally, if you do not have enough space in the default directory that CLI stores logs and data, set the CONFLUENT_CURRENT environment variable to use a different directory:

    export CONFLUENT_CURRENT=<Directory you want to use for CLI logs and data>
    

Tarball or Zip installation

  1. Download and install the most recently released raw binaries by platform:

  2. Set the PATH environment to include the directory that you downloaded the CLI binaries in the previous step.

  3. Optionally, if you do not have enough space in the default directory that CLI stores logs and data, set the CONFLUENT_CURRENT environment variable to use a different directory:

    export CONFLUENT_CURRENT=<Directory you want to use for CLI logs and data>
    

Install alternative version in Confluent Platform packages

Confluent Platform packages include Confluent CLI binaries for each of the operating system and architecture types that Confluent CLI supports.

The version of Confluent CLI used by Confluent Platform can be changed by downloading a specific Confluent CLI binary and using it to replace the current binary.

  1. Download the appropriate version of Confluent CLI as described in Scripted installation.

  2. Use the downloaded binary to replace the existing Confluent CLI binary located in subdirectories of $CONFLUENT_HOME/libexec/cli/. In this example, the appropriate subdirectory is $CONFLUENT_HOME/libexec/cli/darwin_amd64/, which corresponds to the operating system type and architecture type noted above.

  3. Confirm the version and the OS type of the CLI with the following command:

    confluent version
    

Java version requirements

On non-Windows platforms, the Confluent CLI offers confluent local commands (designed to operate on a local install of Confluent Platform) which require Java, and JDK version 1.8 or 1.11 is recommended. If you have multiple versions of Java installed, set JAVA_HOME to the version you want Confluent Platform to use.

Important

Setting JAVA_HOME when you have multiple JDKs prevents the Confluent CLI from defaulting to the newest installed Java version, which may not be supported. If the default Java version is not supported, the CLI will fail with a message about unsupported Java versions even if a supported version is installed and set as the in-use JDK (shown as output to java -version).

  • To set JAVA_HOME, add the location of a supported JDK to your PATH in a file such as .bash_profile or by setting it temporarily as an environment variable in your current shell:

    export JAVA_HOME=<path-to-JDK-home>
    

    For example:

    export JAVA_HOME=/Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/Home/
    
  • To find the location of your installed Java versions, type the following in a command shell:

    /usr/libexec/java_home -V
    

    The output will look similar to this example, which happens to show two JDKs, 12.0.1 and 1.8.0_212:

    /usr/libexec/java_home -V
    Matching Java Virtual Machines (2):
        12.0.1, x86_64: "OpenJDK 12.0.1"        /Library/Java/JavaVirtualMachines/openjdk-12.0.1.jdk/Contents/Home
        1.8.0_212, x86_64:      "AdoptOpenJDK 8"        /Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/Home
    

    In this case, you would add JDK 1.8 to your .bash_profile:

    #JAVA_HOME
    export JAVA_HOME=/Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/Home/
    

    The Confluent CLI will then run with the specified, supported JDK 1.8, regardless of how many Java versions you have installed.

    See also, Java supported versions for Confluent Platform.

Verify

  1. Set the PATH shell variable:

    export PATH=<$CONFLUENT_HOME>/bin:${PATH};
    
  2. Type confluent in your terminal to get started:

    confluent
    

    You should see Confluent CLI usage information:

    Manage your Confluent Platform.
    
    Usage:
        confluent [command]
    
     Available Commands:
        completion  Print shell completion code.
        help        Help about any command
        iam         Manage RBAC and IAM permissions.
        local       Manage a local Confluent Platform development environment.
        login       Log in to Confluent Platform. This is required for RBAC.
        logout      Log out of Confluent Platform.
        secret      Manage secrets for Confluent Platform.
        update      Update the confluent CLI.
        version     Print the confluent CLI version.
    
     Flags:
        -h, --help            help for confluent
        -v, --verbose count   Increase verbosity (-v for warn, -vv for info, -vvv for debug, -vvvv for trace).
            --version         version for confluent
    
     Use "confluent [command] --help" for more information about a command.
    
  3. If RBAC is enabled, you must log in to the Confluent CLI with the Metadata service URL specified (<url>). For more information, see confluent login.

    confluent login --url <url>
    
    Enter your Confluent credentials:
    Email:
    Password:
    

    Your output should resemble:

    Logged in as user
    
  4. Try out the Confluent CLI using a local development environment.

Confluent Platform properties files

The following is a list of the default Confluent Platform services configuration properties files, where $CONFLUENT_HOME is the directory where you installed Confluent Platform. You reference or modify the appropriate file when you work with a Confluent Platform service.

  • Connect: $CONFLUENT_HOME/etc/schema-registry/connect-avro-distributed.properties
  • Control Center: $CONFLUENT_HOME/etc/confluent-control-center/control-center-dev.properties
  • Kafka: $CONFLUENT_HOME/etc/kafka/server.properties
  • REST Proxy: $CONFLUENT_HOME/etc/kafka-rest/kafka-rest.properties
  • ksqlDB: $CONFLUENT_HOME/etc/ksqldb/ksql-server.properties
  • Schema Registry: $CONFLUENT_HOME/etc/schema-registry/schema-registry.properties
  • ZooKeeper: $CONFLUENT_HOME/etc/kafka/zookeeper.properties