Visit our new documentation site! This documentation page is no longer updated.

Installing and Updating the Treasure Data CLI

Table of Contents

Installing

Install the Treasure Data Toolbelt to set up your local workstation with td, the Treasure Data command-line client.

The CLI is distributed in different ways to best suit the target environment:

  1. Windows and Mac OSX as a prepackaged installer called the Toolbelt;
  2. Linux (Ubuntu Precise and Lucid, RedHat, CentOS) as part of the td-agent package;
  3. A Ruby ‘gem’ on any system.

Please use option 3 if are already familiar with Ruby and already have it installed in your system.

Windows (64-bit only)

You can download the CLI as a Toolbelt installer from here: Toolbelt Installer for Windows

Double click it to begin the installation. This package contains all the necessary dependencies to allow the CLI to run on a Windows system and therefore includes a v1.9.3 version of the Ruby environment which will be installed on the system as part of the process.

Mac OSX (v10.8.5 – Mountain Lion – or later)

You can download the CLI as a Toolbelt installer from here: Toolbelt Installer for Mac OSX.

Double click it to begin the installation. This package contains all the necessary dependencies to allow the CLI to run on a Mac system and therefore includes a v2.0 version of the Ruby environment which will be installed on the system as part of the process.

Ubuntu & Debian

The CLI is distributed on Linux as part of the td-agent package. For more information about td-agent, our streaming log collector, refer to the Streaming Import Overview page.

# 14.04 Trusty (64-bit only)
$ curl -L https://toolbelt.treasuredata.com/sh/install-ubuntu-trusty-td-agent2.sh | sh
# 12.04 Precise
$ curl -L https://toolbelt.treasuredata.com/sh/install-ubuntu-precise-td-agent2.sh | sh
# 10.04 Lucid
$ curl -L https://toolbelt.treasuredata.com/sh/install-ubuntu-lucid-td-agent2.sh | sh

# Debian Squeeze (64-bit only)
$ curl -L https://toolbelt.treasuredata.com/sh/install-debian-squeeze-td-agent2.sh | sh
# Debian Wheezy (64-bit only)
$ curl -L https://toolbelt.treasuredata.com/sh/install-debian-wheezy-td-agent2.sh | sh

This package contains all the necessary dependencies to allow the td-agent and td CLI to run on a Linux system, including the version of Ruby these tools are guaranteed to work with.

RedHat / CentOS

The CLI is distributed on Linux as part of the td-agent package. For more information about td-agent, our streaming log collector, refer to the Streaming Import Overview page.

$ curl -L https://toolbelt.treasuredata.com/sh/install-redhat-td-agent2.sh | sh

This package contains all the necessary dependencies to allow the td-agent and td CLI to run on a Linux system, including the version of Ruby these tools are guaranteed to work with.

Ruby Gem

If you are familiar with Ruby, you can opt to install and maintain the td CLI as a gem. To install the CLI and its dependencies, simply run this command:

$ gem install td

If are using a Ruby environment manager such as rbevn or rvm, different versions of the td CLI may be confined within each project / environment / ruby version in use and you may have to install the td gem multiple times. Please refer to the Upgrading, Ruby Gem section below for more information.

Confirm Installation

Please open your terminal, and make sure you have the td command available.

$ td --version
0.11.X

$ td
usage: td [options] COMMAND [args]
...

Checking Installed Versions

Mac OSX of Windows

$ td --version

Redhat/CentOS

$ rpm -q td-agent

Ubuntu

$ dpkg - l | grep td-agent

Upgrading

Depending on how the CLI was originally installed on your machine, there are different ways it can be updated.

Mac OSX or Windows

If you downloaded the CLI as a Toolbelt installer package (.pkg file) for Mac OSX or as a Toolbelt installer executable for Windows (64-bit support only) from the Treasure Data Toolbelt website, the Toolbelt CLI is enabled with the ability to auto-update itself.

Whenever a command is invoked from the CLI, the program will check whether a new version exists and will download and install the updated version in the background. The CLI will check for an updated version every hour. The user can at any time trigger an update with the following command:

$ td update

The auto-update feature is available as of v0.10.77. If you are running an earlier version (please check the version with the td --version command), please upgrade as soon as possible by installing a more recent package from Treasure Data Toolbelt.

The td update command is just a placeholder for the following other installation methods.

Linux (Ubuntu Precise, Ubuntu Lucid, RedHat, CentOS)

The easier way of installing the td CLI in a Linux environment beside using a gem (see above) is to install td as part of the td-agent distribution package. When upgrading between v1 and v2 of Treasure Agent, a full uninstall must be completed since the package types are incompatible between major version releases.

Redhat/CentOS

Step 1: Remove td-agent v1

$ sudo yum remove td-agent

Step 2: Install td-agent v2

$ curl -L https://td-toolbelt.herokuapp.com/sh/install-redhat-td-agent2.sh | sh

Ubuntu

Step 1: Remove td-agent v1

$ sudo apt-get remove td-agent

Step 2: Install td-agent v2

For Precise:

$ curl -L https://td-toolbelt.herokuapp.com/sh/install-ubuntu-precise-td-agent2.sh | sh

For Lucid:

$ curl -L https://td-toolbelt.herokuapp.com/sh/install-ubuntu-lucid-td-agent2.sh | sh

The Treasure Agent environment provisions its own gem environment and the corresponding gem command is accessible in this location /usr/lib*/fluent/ruby/bin/fluent-gem. To update the td CLI to the latest version without having to wait until the next td-agent release", please run:

$ /usr/lib*/fluent/ruby/bin/fluent-gem update td

Ruby Gem

If you installed the CLI as a gem you will need to periodically check whether a newer version exists. It is always recommended to update to the latest version since we strive to maintain 100% backwards compatibility. To update using the gem command run:

$ gem update td

If are using a Ruby environment manager such as rbevn or rvm, different versions of the td CLI may be confined within each project / environment / ruby version.

Also if gem install was invoked with a customized GEM_HOME environment variable or bundler’s bundle install was called with the —path option, the installed gems are local to the project (and typically installed within the project’s folder structure itself), not globally installed and available everywhere in the system.

One can always double check the version of td gem in use by running:

$ gem list | grep -E '^td '
td (0.11.2, 0.10.99, 0.10.97)

Depending on the situation the gem may have to replaced by a wrapper: e.g. /usr/bin/ruby/toolbelt/bin/gem or /usr/lib/fluent/ruby/bin/fluent-gem.


Last modified: Feb 24 2017 09:27:52 UTC

If this article is incorrect or outdated, or omits critical information, let us know. For all other issues, access our support channels.