influxdata-docker
influxdata-docker copied to clipboard
Plain influx container in setup mode leads to "Error: config name "default" already exists"
In a docker compose setup with the following configuration for the influx service I get a weird error on some (not on all! host machines):
db:
image: influxdb:latest
ports:
- "8086:8086"
restart: on-failure
volumes:
- influx_data:/var/lib/influxdb2
environment:
- DOCKER_INFLUXDB_INIT_MODE=setup
- DOCKER_INFLUXDB_INIT_USERNAME=user
- DOCKER_INFLUXDB_INIT_PASSWORD=password1234
- DOCKER_INFLUXDB_INIT_ORG=some_org
- DOCKER_INFLUXDB_INIT_BUCKET=some_data
- DOCKER_INFLUXDB_INIT_ADMIN_TOKEN=4eYvsu8wZCJ6tKuE2sxvFHkvYFwSMVK0011hEEiojvejzpSaij86vYQomN_12au6eK-2MZ6Knr-Sax201y70w==
On some machines this immediatly leads to the container being stuck in restarting over and over again due to the following error:
Error: config name "default" already exists
As I see it this error shows up, if the config file in /etc/influxdb2
already has an entry for default
. But the error also pops up if the container is started on a machine that has not hosted the setup so far, so I assume that the influx setup
is executed twice for some reason, although I do not see where that would be in the entrypoint.sh
.
Hey, I had the same problem. The config name "Default" seems to be there by default. Which means it can't be used.
Specify the additional environemnt variable "DOCKER_INFLUXDB_INIT_CLI_CONFIG_NAME=configname". Then it will work as expected.
Have a look at https://github.com/influxdata/influxdata-docker/blob/master/influxdb/2.1/entrypoint.sh There is a function called setup_influxd showing details about what happens.
I just restarted it and now it says the config "configname" already exists. Okay that needs to be fixed by the devs. It simply should not do anything if the config already exists.
Yes and it sometimes even initializes fine, but then when restarting the container at a later point goes back to Error: config name "CONFIG" already exists
In my case the config is persistent via
volumes:
- ./influxdb/data:/var/lib/influxdb2
- ./influxdb/config:/etc/influxdb2
Unfortunately this is completely unusable in its current state
Yes, that's exactly the problem I have. The container breaks for some other reason, but the restart is not possible because 'default' config is already there. Even if you don't specify a volume for the config yourself, it is still persistent, due to a volume being defined in the dockerfile...
But if I'm correct the problem then lies in influx itself so this issue is misplaced in this repository, no?
But if I'm correct the problem then lies in influx itself so this issue is misplaced in this repository, no?
No it is not misplaced in this repo. Have a look at https://github.com/influxdata/influxdata-docker/blob/master/influxdb/2.1/entrypoint.sh There is a function called setup_influxd showing details about what happens.
What needs to be done: The environment variables provided to the container should be treated declarative. Which means they describe how the desired state should be. Currently they are interpreted imperative as a command executed each single time. Which results in errors if the config already exists.
Where should this be fixed? I see multiple possibilities:
- "influx setup" command gets a flag to "update if config already exists". This new flag then can be used inside entrypoint.sh
- entrypoint.sh might be extended to check if a config already exists, if yes, overriding the settings inside
- entrypoint.sh might be extended to check if a config already exists, if yes not touching the config
What solution do I prefer? I prefer 2 over 3 since the variables are entered for a purpose, 3 would ignore the wish of the user. solution 1 would be nice for some admins writing scripts, but since that feels more complicated to implement I would prefer 2 here aswell.
But it seems to be debatable if the variables containing INIT are supposed to be evaluated twice. 3 might therefore be a nice solution aswell. For example should the DOCKER_INFLUXDB_INIT_BUCKET be created if it doesn't exist? Working declarative is the desired behaviour in each case.
Have a look at the folks providing the mariadb container.
MARIADB_DATABASE -> This variable allows you to specify the name of a database to be created on image startup.
The existance of the database is the desired state. It will be created if it is not existing, and it is untouched if it already exists. The influxdb image should get rid of the "INIT" variables (of course keeping it for backwards compatibility) and instead switch to declarative behaviour aswell.
i made a pull request https://github.com/influxdata/influxdata-docker/pull/556
@razaqq re:
Yes and it sometimes even initializes fine, but then when restarting the container at a later point goes back to
Error: config name "CONFIG" already exists
Does anything happen between when the container runs without error, and later getting an error on restart? I am wondering because the only way I can reproduce this is by deleting the data mounted at /var/lib/influxdb2
so that the initialization runs again. If you're seeing it occur even though there's data mounted in /var/lib/influxdb2
, that would be more significant.
In the case of removing the data directory (basically starting fresh) at /var/lib/influxdb2
leading to failures to start because of the config already existing, it should be possible to work around this removing the influx-config
file from the volume created at /etc/influxdb2
, either via the docker volume or creating a mount at /etc/influxdb2
and removing the file there.
Given that, I can not mount the config file location from the host volume without the influxdbv2 container getting stuck on the restart.
I decided to sacrifice the config file persistence and move on while the issue gets fixed.
it is working this way and container restarts without issues
Just ran into this as well.
For some reason I could just docker rm influx
and then run the container again with the same docker-compose file:
version: '3.5'
services:
influx:
container_name: influx
image: influxdb:2.5.1
restart: 'unless-stopped'
ports:
- 8086:8086
volumes:
- ./influx-data:/var/lib/influxdb2
- ./config:/etc/influxdb2
environment:
- DOCKER_INFLUXDB_INIT_MODE=setup
- DOCKER_INFLUXDB_INIT_USERNAME=admin
- DOCKER_INFLUXDB_INIT_PASSWORD=password
- DOCKER_INFLUXDB_INIT_ORG=home
- DOCKER_INFLUXDB_INIT_BUCKET=home
- DOCKER_INFLUXDB_INIT_RETENTION=100w
- DOCKER_INFLUXDB_INIT_ADMIN_TOKEN=V2-token==
Did not deep dive on this to check what the actual error is.
Hello everyone,
I merged https://github.com/influxdata/influxdata-docker/pull/556 yesterday. However, upon further inspection today (I was porting it to newer versions of the container), I'm not sure this is going to resolve the issue. Looking at entrypoint.sh
, init_influxd
only executes when $BOLT_PATH
is nonexistent and $DOCKER_INFLUXDB_INIT_MODE
is set to setup
.
So far, I can only reproduce this by deleting the bolt database or modifying $BOLT_PATH
. The aforementioned PR doesn't help in this scenario because the database needs to be initialized. I'm still attempting to track down other causes, so I'm re-opening.
Another Edit: I also agree that stateless configuration is the best path forward. However, the current implementation regarding influx
and influxd
needs some work.
after a bunch of troubleshooting I discovered that it doesnt like the following option:
-v "${pwd}"/entrypoint-initdb.d/influx-configs:/etc/influxdb2/influx-configs
If you have the above you will get the following error:
Error: config name "default" already
and if you have an entrypoint script with the -r in relationship to anything apart from "s" function you will get this error:
Error: unknown command "90d" for "create"
Note: there is nothing wrong with:
-e DOCKER_INFLUXDB_INIT_RETENTION=<value>
here is a handy script to build influx:
#!/bin/bash
function info {
tput bold;
tput setaf 3;
echo $1;
tput sgr0;
}
# Check if the user has root privileges
if [[ $EUID -ne 0 ]]; then
echo "YOU MUST BE ROOT TO RUN THIS SCRIPT."
exit 1
fi
info "=== Before we begin we need some information ==="
read -r -p "PRESS ENTER WHEN READY"
info "=== LINUX OS DETERMINATION ==="
# shellcheck disable=SC2155
# shellcheck disable=SC2002
export ID=$( cat /etc/os-release | awk -F= '$1=="ID" { print $2 ;}')
# shellcheck disable=SC2155
# shellcheck disable=SC2002
export VARIANT=$( cat /etc/os-release | awk -F= '$1=="VARIANT_ID" { print $2 ;}')
echo "${ID}" "${VARIANT}"
info "=== Setting up InfluxDB ==="
## password and tokens ##
# shellcheck disable=SC2155
export RANDOM_PASSWD=$(tr -dc A-Za-z0-9 </dev/urandom | head -c 13 ; echo '')
# shellcheck disable=SC2155
export LENGTH=86
# shellcheck disable=SC2155
export RANDOM_TOKEN=$(tr -dc A-Za-z0-9 </dev/urandom | head -c ${LENGTH} ; echo '')
export INFLUXDB_INIT_ADMIN_TOKEN=${RANDOM_TOKEN}==
info "=== Add a New User ==="
read -r -p "Enter New User Name [default: admin]: " userName
export INFLUXDB_INIT_USERNAME=${userName:-admin}
info "=== Add User Password ==="
read -r -p "Enter Your User Password [default: ${RANDOM_PASSWD}]: " userPasswd
export INFLUXDB_INIT_PASSWORD=${userPasswd:-${RANDOM_PASSWD}}
info "=== Add a New Organisation ==="
read -r -p "Enter New Organisation Name [example: my_influx]: " orgName
export INFLUXDB_INIT_ORG=${orgName:-}
info "=== Add a Bucket Name ==="
read -r -p "Enter Bucket Name [example: fluent_bit]: " bucketName
export INFLUXDB_WIFI_BUCKET_ID=${bucketName:-}
info "=== Add a Custom Root Directory Location for your Containers ==="
read -r -p "Enter Custom Root Directory [example: /var/mnt]: " rootDir
export ROOT_DIR=${rootDir:-/var/mnt}
export INFLUX_HOME_DIR=${ROOT_DIR}/influx
if [[ -d ${ROOT_DIR}/influx ]]; then
rm -rf "${ROOT_DIR}"/influx
elif [[ ! -d ${ROOT_DIR}/influx ]]; then
mkdir -p "${INFLUX_HOME_DIR}"/entrypoint-initdb.d/config
export INFLUX_DATA_DIR=${INFLUX_HOME_DIR}/data
mkdir -p "${INFLUX_DATA_DIR}"
fi
info "=== Add a Custom Port for your Container ==="
read -r -p "Enter Custom Port [default: 8086]: " customPort
export INFLUX_PORT=${customPort:-8086}
# shellcheck disable=SC2155
export INFLUX_PORT_CHECK=$(lsof -i -P -n | grep "${INFLUX_PORT}")
if [[ "${INFLUX_PORT_CHECK}" != "" ]]; then
info "=== PORT IN USE - WOULD YOU LIKE ME TO CHOOSE A PORT FOR YOU? ==="
read -r -p "Please Enter your Response [enter: Y or N]: " influxAnswer
export INFLUX_ANSWER=${influxAnswer:-}
fi
if [[ "${INFLUX_ANSWER}" =~ (Y|y) ]]; then
while [[ -n "${INFLUX_PORT_CHECK}" ]]; do
echo "Port ${INFLUX_PORT} is in use. Trying another port..."
INFLUX_PORT=$((INFLUX_PORT + 1))
INFLUX_PORT_CHECK=$(lsof -i -P -n | grep "${INFLUX_PORT}")
echo "${INFLUX_PORT}"
done
elif [[ "${INFLUX_ANSWER}" =~ (N|n) ]]; then
while [[ -n "${INFLUX_PORT_CHECK}" ]]; do
echo "Port ${INFLUX_PORT} is in use. Trying another port..."
read -r -p "Enter a new port: " newINFLUXPort
INFLUX_PORT=${newINFLUXPort}
INFLUX_PORT_CHECK=$(lsof -i -P -n | grep "${INFLUX_PORT}")
done
fi
info "=== Please take note of the last port above ==="
read -r -p "PRESS ENTER WHEN READY"
if [[ -e /etc/containers/registries.conf ]];then
rm /etc/containers/registries.conf
cat <<EOF >> /etc/containers/registries.conf
[registries.search]
registries = ['docker.io']
EOF
fi
cat <<EOF >> "${INFLUX_HOME_DIR}"/entrypoint-initdb.d/admin_token
${INFLUXDB_INIT_ADMIN_TOKEN}
EOF
cat <<EOF >> "${INFLUX_HOME_DIR}"/entrypoint-initdb.d/influx_org
${INFLUXDB_INIT_ORG}
EOF
cat <<EOF >> "${INFLUX_HOME_DIR}"/entrypoint-initdb.d/influx-configs
[default]
url = "http://localhost:8086"
org = "${INFLUXDB_INIT_ORG}"
token = "${INFLUXDB_INIT_ADMIN_TOKEN}"
active = true
EOF
cat <<EOF >> "${INFLUX_HOME_DIR}"/entrypoint-initdb.d/ui-passwd
${INFLUXDB_INIT_PASSWORD}
EOF
cat <<EOF >> "${INFLUX_HOME_DIR}"/entrypoint-initdb.d/01-entry.sh
#!/bin/bash
set -e
influx bucket create \\
--org ${INFLUXDB_INIT_ORG} \\
--name ${INFLUXDB_WIFI_BUCKET_ID} \\
--retention 7776000s
influx bucket create \\
--org ${INFLUXDB_INIT_ORG} \\
--name bucket \\
--retention 7776000s
EOF
chmod +x "${INFLUX_HOME_DIR}"/entrypoint-initdb.d/01-entry.sh
podman run -d \
--name influxdb \
--security-opt label=disable \
--privileged \
-e DOCKER_INFLUXDB_INIT_MODE=setup \
-e DOCKER_INFLUXDB_INIT_USERNAME="${INFLUXDB_INIT_USERNAME}" \
-e DOCKER_INFLUXDB_INIT_PASSWORD="${INFLUXDB_INIT_PASSWORD}" \
-e DOCKER_INFLUXDB_INIT_ORG="${INFLUXDB_INIT_ORG}" \
-e DOCKER_INFLUXDB_INIT_BUCKET=system \
-e DOCKER_INFLUXDB_INIT_RETENTION=90d \
-e DOCKER_INFLUXDB_INIT_ADMIN_TOKEN="${INFLUXDB_INIT_ADMIN_TOKEN}" \
-e INFLUXD_SESSION_LENGTH=480 \
-e INFLUXD_SESSION_RENEW_DISABLED=true \
-p "${INFLUX_PORT}":8086 \
-v "${INFLUX_DATA_DIR}":/var/lib/influxdb2 \
-v "${INFLUX_HOME_DIR}"/entrypoint-initdb.d/config:/etc/influxdb2 \
-v "${INFLUX_HOME_DIR}"/entrypoint-initdb.d:/docker-entrypoint-initdb.d \
--healthcheck-start-period 2m \
--healthcheck-retries 5 \
--healthcheck-interval="60s" \
--healthcheck-command 'CMD-SHELL curl http://localhost:8086 || exit 1' \
influxdb:latest \
--reporting-disabled
# -v "${INFLUX_HOME_DIR}"/entrypoint-initdb.d/influx-configs:/etc/influxdb2/influx-configs \
cat <<EOF > /etc/systemd/system/influxdb.service
[Unit]
Description=Influx Container
After=firewalld.service
[Service]
Restart=always
ExecStart=/usr/bin/podman start -a influxdb
ExecStop=/usr/bin/podman stop -t 2 influxdb
ExecRestart=/usr/podman restart influxdb
[Install]
WantedBy=multi-user.target
EOF
systemctl daemon-reload
systemctl enable influxdb && systemctl start influxdb
cat <<EOF > "${INFLUX_HOME_DIR}"/influx_update-init.sh
#!/bin/bash
sudo systemctl disable influxdb
sudo podman stop influxdb
sleep 1
sudo podman rm -f influxdb
sleep 1
sudo podman rmi influxdb
sleep 1
podman run -d \\
--name influxdb \\
--security-opt label=disable \\
--privileged \\
-e INFLUXD_SESSION_LENGTH=480 \\
-e INFLUXD_SESSION_RENEW_DISABLED=true \\
-p "${INFLUX_PORT}":8086 \\
-v "${INFLUX_DATA_DIR}":/var/lib/influxdb2 \\
-v "${INFLUX_HOME_DIR}"/entrypoint-initdb.d/config:/etc/influxdb2 \\
-v "${INFLUX_HOME_DIR}"/entrypoint-initdb.d:/docker-entrypoint-initdb.d \\
--healthcheck-start-period 2m \\
--healthcheck-retries 5 \\
--healthcheck-interval="60s" \\
--healthcheck-command 'CMD-SHELL curl http://localhost:8086 || exit 1' \\
influxdb:latest \\
--reporting-disabled
EOF
# -v "${INFLUX_HOME_DIR}"/entrypoint-initdb.d/influx-configs:/etc/influxdb2/influx-configs \\
info "=== DETERMINING FIREWALL STATE ==="
if [[ "${ID}" = "fedora" ]]; then
# shellcheck disable=SC2155
export FIREWALL_STATE=$(firewall-cmd --state)
echo "${VARIANT}" "${ID}" "${FIREWALL_STATE}"
elif [[ "${ID}" == "debian" || "${ID}" == "ubuntu" ]]; then
# shellcheck disable=SC2155
export FIREWALL_STATE=$(ufw status | awk -F: '$1=="Status" { print $2;}')
echo "${ID}" "${VARIANT}" "${FIREWALL_STATE}"
fi
if [[ "${ID}" = "fedora" ]]; then
# shellcheck disable=SC2155
export ACTIVE_ZONE=$(firewall-cmd --get-active-zones | awk 'NR==1')
echo "ACTIVE ZONE=""${ACTIVE_ZONE}"
fi
if [[ "${ID}" == "fedora" ]] && [[ "${FIREWALL_STATE}" == "running" ]]; then
echo "== FIREWALL IS RUNNING - APPLYING INFLUX PORTS TO FIREWALL =="
firewall-cmd --zone="${ACTIVE_ZONE}" --permanent --add-port="${INFLUX_PORT}"/tcp
firewall-cmd --reload
elif [[ "${ID}" == "debian" || "${ID}" == "ubuntu" ]] && [[ "${FIREWALL_STATE}" == "active" ]]; then
echo "== FIREWALL IS ACTIVE - APPLYING INFLUX PORTS TO FIREWALL =="
ufw allow "${INFLUX_PORT}"/tcp
ufw disable && ufw enable
fi
wait
So, I ran into this issue even after the fix.
I was creating a new influx container and wiping the data volume mounted at /var/lib/influxdb2, but not the config volume at /etc/influxdb2 . Which meant that every time i did the setup another entry and config name was created, which when i reran dockercompose again would be unavailable and cause the "Error: config name "..." already exists"
here my docker compose I use without external files or scripts with portainer
version: '3.9'
services:
# Service container
# Purge any leftover files, clone repo, copy necessary files to the temporary volume
# Note: you could also use a sparse checkout for this (size of clone, performance), but I didn't since my use case was pretty small
setup:
image: bitnami/git:latest
container_name: setup
command: >
bash -c "
echo clearing Volumes
rm -rf /home/influxdb/*
rm -rf /home/influxconfig/*
echo emptied:
ls /home/influxdb
"
volumes:
- influxdbv2:/home/influxdb
- influxconfig:/home/influxconfig
influxdb:
image: influxdb
container_name: influxdb2
depends_on:
setup:
condition: service_completed_successfully
volumes:
- influxdbv2:/var/lib/influxdb2:rw
- influxconfig:/etc/influxdb2
ports:
- "8086:8086"
networks:
- 'network'
networks:
network:
driver: bridge
name: influxdb-telegraf-net
volumes:
influxdbv2:
influxconfig:
I'm having the same problem. I created the needed folders and use the following docker-compose.yaml
version: "3.8"
networks:
tig-backend:
proxy:
external: true
services:
influxdb:
image: influxdb:2.7-alpine
restart: always
environment:
- DOCKER_INFLUXDB_INIT_MODE=setup
- DOCKER_INFLUXDB_INIT_USERNAME=tigiadmin
- 'DOCKER_INFLUXDB_INIT_PASSWORD=${INFLUXDB_ADMIN_PASSWORD}'
- DOCKER_INFLUXDB_INIT_ORG=TIG
- DOCKER_INFLUXDB_INIT_BUCKET=influx
volumes:
- '/etc/localtime:/etc/localtime:ro'
- '${INSTANCE_FOLDER:-.}/data/influxdb:/var/lib/influxdb2'
- '${INSTANCE_FOLDER:-.}/config/influxdb:/etc/influxdb2'
networks:
- tig-backend
Once the container was create the config folder is still empty but the data folder contains influxd.sqlite file and engine folder but no influxd.bolt file,
The log docker log contains:
{
"bolt-path": "/var/lib/influxdb2/influxd.bolt",
"engine-path": "/var/lib/influxdb2/engine",
"http-bind-address": ":9999",
"nats-port": 4222
}
2023-09-03T16:17:46. info booting influxd server in the background {"system": "docker"}
ts=2023-09-03T16:17:46.324791Z lvl=info msg="Welcome to InfluxDB" log_id=0k2yDaL0000 version=v2.7.1 commit=407fa622e9 build_date=2023-04-28T13:24:27Z log_level=info
ts=2023-09-03T16:17:46.324813Z lvl=warn msg="nats-port argument is deprecated and unused" log_id=0k2yDaL0000
ts=2023-09-03T16:17:46.344387Z lvl=info msg="Resources opened" log_id=0k2yDaL0000 service=bolt path=/var/lib/influxdb2/influxd.bolt
ts=2023-09-03T16:17:46.344556Z lvl=info msg="Resources opened" log_id=0k2yDaL0000 service=sqlite path=/var/lib/influxdb2/influxd.sqlite
ts=2023-09-03T16:17:46.348936Z lvl=info msg="Bringing up metadata migrations" log_id=0k2yDaL0000 service="KV migrations" migration_count=20
ts=2023-09-03T16:17:46.882581Z lvl=info msg="Using data dir" log_id=0k2yDaL0000 service=storage-engine service=store path=/var/lib/influxdb2/engine/data
ts=2023-09-03T16:17:46.882676Z lvl=info msg="Compaction settings" log_id=0k2yDaL0000 service=storage-engine service=store max_concurrent_compactions=1 throughput_bytes_per_second=50331648 throughput_bytes_per_second_burst=50331648
ts=2023-09-03T16:17:46.882689Z lvl=info msg="Open store (start)" log_id=0k2yDaL0000 service=storage-engine service=store op_name=tsdb_open op_event=start
ts=2023-09-03T16:17:46.882755Z lvl=info msg="Open store (end)" log_id=0k2yDaL0000 service=storage-engine service=store op_name=tsdb_open op_event=end op_elapsed=0.067ms
ts=2023-09-03T16:17:46.882776Z lvl=info msg="Starting retention policy enforcement service" log_id=0k2yDaL0000 service=retention check_interval=30m
ts=2023-09-03T16:17:46.882809Z lvl=info msg="Starting precreation service" log_id=0k2yDaL0000 service=shard-precreation check_interval=10m advance_period=30m
ts=2023-09-03T16:17:46.883477Z lvl=info msg="Starting query controller" log_id=0k2yDaL0000 service=storage-reads concurrency_quota=1024 initial_memory_bytes_quota_per_query=9223372036854775807 memory_bytes_quota_per_query=9223372036854775807 max_memory_bytes=0 queue_size=1024
ts=2023-09-03T16:17:46.886221Z lvl=info msg="Configuring InfluxQL statement executor (zeros indicate unlimited)." log_id=0k2yDaL0000 max_select_point=0 max_select_series=0 max_select_buckets=0
ts=2023-09-03T16:17:46.904148Z lvl=info msg=Starting log_id=0k2yDaL0000 service=telemetry interval=8h
ts=2023-09-03T16:17:46.904190Z lvl=info msg=Listening log_id=0k2yDaL0000 service=tcp-listener transport=http addr=:9999 port=9999
2023-09-03T16:17:47. info pinging influxd... {"system": "docker", "ping_attempt": "0"}
2023-09-03T16:17:47. info got response from influxd, proceeding {"system": "docker", "total_pings": "1"}
Error: config name "default" already exists
2023-09-03T16:17:47. warn cleaning bolt and engine files to prevent conflicts on retry {"system": "docker", "bolt_path": "/var/lib/influxdb2/influxd.bolt", "engine_path": "/var/lib/influxdb2/engine"}
Edit: the conf and data folders are owned by 1000:1000 and have the rights 0700
Same issue with kubernetes deployment via kustomize. I have a startup script mounted under: '/docker-entrypoint-initdb.d' and setting some setup environment variables as well. The script is executed successfully.
With just the setup environment variables ('DOCKER_INFLUXDB_INIT_*') the pod comes up.
So I've ended up with running the setup script manually after the pod/container is up and running (ugly workaround).
This is the k8 deployment of influx:
apiVersion: apps/v1
kind: Deployment
metadata:
name: influxdb
spec:
selector:
matchLabels:
app: influxdb
minReadySeconds: 5
template:
metadata:
labels:
app: influxdb
spec:
containers:
- image: influxdb:alpine
name: influxdb
ports:
- containerPort: 8086
volumeMounts:
- mountPath: /var/lib/influxdb2
name: influxdb-data
- mountPath: /etc/influxdb2
name: influxdb-data
- name: init-script #be aware that this didn't work at the moment see readme
mountPath: /docker-entrypoint-initdb.d
resources:
requests:
cpu: 250m
memory: 500Mi
limits:
cpu: 500m
memory: 1Gi
envFrom:
- configMapRef:
name: influxdb-bootstrap-config #containing: DOCKER_INFLUXDB_INIT_* variables
- secretRef:
name: influxdb-secrets
volumes:
- name: influxdb-data
persistentVolumeClaim:
claimName: influxdb-pvc
- name: init-script
configMap:
name: influx-initscript-configmap # containing the shell script for initial config, and definition of downsample tasks
defaultMode: 0777
I was receiving this same error "Error: config name "default" already exists"
and it wound up being due to me trying to keep an influxDB2 config preserved in a volume from the Docker host.
I had a directory influxdb2-config/
that was a volume mount to /etc/influxdb2/
and within that an existing config file: influx-configs
which had a [default]
section defined within. The values in this file were are all created by the ENV vars though, so I just removed the file and let the docker compose recreate it.
In my case the config file was there because I copied it over from another machine thinking I needed it, just needed the ENV vars though.
I'm not even using a seperate config file but I'm still getting the same error. I was not getting it previously.
For me worked passing a password more large
docker exec influxdb2 influx setup \
--username influx \
--password influx \
--org $ORG \
--bucket $BUCKET \
--force
Error: password is too short
The error arises in regards to this line:
- v ${INFLUX_HOME_DIR}"/entrypoint-initdb.d/config:/etc/influxdb2 \
If it's not as above on the right hand side you will get the error about the config
I've amended my script and I am able to build with entry point and dictate config with success
This still happening to me on the latest release tag (maybe due to a forced shutdown of the container).
I deleted the config and data volumes with docker-compose down -v
. After restarting the container, i haven't had this bug again.
I didn't have any data in the vols but this won't work for others.