influxdata / influxdb

Scalable datastore for metrics, events, and real-time analytics
https://influxdata.com
Apache License 2.0
28.96k stars 3.56k forks source link

Unknown command "generate" for "influxd" #21855

Closed Aloike closed 3 years ago

Aloike commented 3 years ago

Steps to reproduce:

I wrote a Bash script to reproduce/highlight the issue in Docker (see below).

What it basically does:

  1. Run an influxDB container with the latest InfluxDB version (to this day: 2.0.7);
  2. Wait for it to be ready;
  3. Set up the InfluxDB instance using the influx setup command;
  4. Generate a simple data set using the influxd generate simple command.

The last command fails with the following error:

Error: unknown command "generate" for "influxd"
See 'influxd -h' for help

Expected behavior: Given this page, I would expect the generate command to be "known" in InfluxDB 2.0. Even if not used correctly/not available (due to the running influxd instance).

Actual behavior:

influxd generate simple fails with the following error:

Error: unknown command "generate" for "influxd"
See 'influxd -h' for help

Environment info:

Config:

Following is the script I'm using to test this:

#!/bin/bash

DOCKER_VOLUMES_ROOTDIR='/tmp/docker/test-influxd-generate'

DOCKER_DIR_INFLUXDB_DATA="${DOCKER_VOLUMES_ROOTDIR}/influxdb2/data"

##  @brief  The name of the InfluxDB container.
INFLUXDB_CONTAINERNAME='test-influxd-generate'

#
# InfluxDB setup variables
#
INFLUXDB_ORG='my.org'
INFLUXDB_ADMIN_USERNAME='admin_username'
INFLUXDB_ADMIN_PASSWORD='admin_password'
INFLUXDB_ADMIN_TOKEN='admin_token'
INFLUXDB_PRIMARYBUCKET='primarybucket'

set -e
# set -x

echo "+-- Create directories..."
mkdir -pv ${DOCKER_DIR_INFLUXDB_DATA}
echo "    +-- Done create directories."

#
# Start the container
#
echo "+-- Pull the latest container tag..."
docker pull influxdb:latest
echo "    +-- Done pulling the latest container tag."

echo "+-- Start the container..."
docker run \
    -d \
    --name=${INFLUXDB_CONTAINERNAME} \
    --publish 8086:8086 \
    -v ${DOCKER_DIR_INFLUXDB_DATA}:/root/.influxdbv2 \
    influxdb:latest
echo "    +-- Container is running."

#
# Wait for the database service to be ready
#
echo "+-- Check container state..."
while ! docker exec -it \
    ${INFLUXDB_CONTAINERNAME} \
    influx ping >/dev/null
do
    echo "    +-- Waiting for the InfluxDB container to be ready..."
    sleep 1
done
echo "    +-- Container is ready."

#
# Proceed to the initial setup of InfluxDB
#
echo "+-- Start InfluxDB setup command."
docker exec -it \
    ${INFLUXDB_CONTAINERNAME} \
    influx setup \
    --org ${INFLUXDB_ORG} \
    --username ${INFLUXDB_ADMIN_USERNAME} \
    --password ${INFLUXDB_ADMIN_PASSWORD} \
    --token ${INFLUXDB_ADMIN_TOKEN} \
    --bucket ${INFLUXDB_PRIMARYBUCKET} \
    --retention 0 \
    --force
echo "    +-- InfluxDB setup done."

#
# Get container infos
#
echo "+-- Provide some container infos:"
echo -n    "    +-- Container System info:      "
docker exec -it \
    ${INFLUXDB_CONTAINERNAME} \
    uname -srm

echo -n    "    +-- Container InfluxDB version: "
docker exec -it \
    ${INFLUXDB_CONTAINERNAME} \
    influxd version
echo "    +-- Done retrieveing container infos"

#
# Generate a simple data set
#
##  @see    https://docs.influxdata.com/influxdb/v2.0/reference/cli/influxd/generate/simple/
echo "+-- InfluxDB - Generate a simple data set..."
docker exec -it \
    ${INFLUXDB_CONTAINERNAME} \
    influxd generate simple
echo "    +-- Done generating a simple data set."

exit $?
danxmoran commented 3 years ago

@Aloike thank you for reporting this, and apologies for the confusion. I've honestly never heard of a generate subcommand before... it looks like that page has been in our docs repo for awhile, will check in with our docs team to investigate

danxmoran commented 3 years ago

The docs have been updated, closing this