Describe the problem/error/question
Hello Team,
In order to scale the system more and better, I want to know how we can implement the Redis in n8n instance.
Further, which are re-request, files modification, and any other improvement need.
What is the error message (if any)?
No
Please share your workflow
(Select the nodes on your canvas and use the keyboard shortcuts CMD+C/CTRL+C and CMD+V/CTRL+V to copy and paste the workflow.)
Share the output returned by the last node
Information on your n8n setup
- n8n version: 0.234.1
- Database (default: SQLite): Postgress
- n8n EXECUTIONS_PROCESS setting (default: own, main): main
- Running n8n via (Docker, npm, n8n cloud, desktop app): docker
- Operating system: MacOS
Hey @Gouravdev,
Assuming you are referring to queue mode you can find this in our documentation here: Scaling n8n | n8n Docs
@Jon
May you please share a reference docker file where redis is being used…
my docker file
version: '3.4'
services:
pgadmin:
image: dpage/pgadmin4:8.2
container_name: n8n_pgadmin
restart: always
environment:
- PGADMIN_DEFAULT_EMAIL=${PGADMIN_EMAIL}
- PGADMIN_DEFAULT_PASSWORD=${PGADMIN_PASSWORD}
ports:
- "8086:80"
postgres:
image: postgres:14
container_name: n8n_postgres
restart: always
environment:
- POSTGRES_DB=${DATABASE_DB}
- POSTGRES_PASSWORD=${DATABASE_PASSWORD}
volumes:
- './pg_data:/var/lib/postgresql/data'
user: '501:20'
redis:
image: redis:7.0.8
container_name: n8n_redis
ports:
- "6379:6379"
user: '501:20'
n8n:
container_name: n8n_app
build:
context: .
dockerfile: Dockerfile-n8n
args:
- N8N_VERSION=0.234.1
- DB_TYPE=postgresdb
- DB_POSTGRESDB_DATABASE=${DATABASE_DB}
- DB_POSTGRESDB_USER=${DATABASE_USER}
- DB_POSTGRESDB_HOST=${DATABASE_HOST}
- DB_POSTGRESDB_PORT=${DATABASE_PORT}
- DB_POSTGRESDB_PASSWORD=${DATABASE_PASSWORD}
- N8N_BASIC_AUTH_ACTIVE=${N8N_BASIC_AUTH_ACTIVE}
- N8N_PORT=5678
- N8N_SMTP_HOST=${N8N_SMTP_HOST}
- N8N_SMTP_PORT=${N8N_SMTP_PORT}
- N8N_SMTP_USER=${N8N_SMTP_USER}
- N8N_SMTP_PASS=${N8N_SMTP_PASS}
- N8N_SMTP_SSL=${N8N_SMTP_SSL}
- GENERIC_TIMEZONE=${GENERIC_TIMEZONE}
- EXECUTIONS_DATA_MAX_AGE=${EXECUTIONS_DATA_MAX_AGE}
- N8N_LOG_LEVEL=${N8N_LOG_LEVEL}
- N8N_LOG_OUTPUT=${N8N_LOG_OUTPUT}
- N8N_LOG_FILE_LOCATION=${N8N_LOG_FILE_LOCATION}
- N8N_LOG_FILE_MAXSIZE=${N8N_LOG_FILE_MAXSIZE}
- N8N_LOG_FILE_MAXCOUNT=${N8N_LOG_FILE_MAXCOUNT}
- N8N_DIAGNOSTICS_ENABLED=${N8N_DIAGNOSTICS_ENABLED}
- N8N_VERSION_NOTIFICATIONS_ENABLED=${N8N_VERSION_NOTIFICATIONS_ENABLED}
- N8N_ENCRYPTION_KEY=${N8N_ENCRYPTION_KEY}
- QUEUE_BULL_REDIS_HOST=${QUEUE_BULL_REDIS_HOST}
- QUEUE_BULL_REDIS_PORT=${QUEUE_BULL_REDIS_PORT}
# - QUEUE_BULL_REDIS_USERNAME=${QUEUE_BULL_REDIS_USERNAME}
# - QUEUE_BULL_REDIS_PASSWORD=${QUEUE_BULL_REDIS_PASSWORD}
# - QUEUE_BULL_REDIS_DB=${QUEUE_BULL_REDIS_DB}
# - QUEUE_BULL_REDIS_TIMEOUT_THRESHOLD=${QUEUE_BULL_REDIS_TIMEOUT_THRESHOLD}
# - QUEUE_RECOVERY_INTERVAL=${QUEUE_RECOVERY_INTERVAL}
# - QUEUE_WORKER_TIMEOUT=${QUEUE_WORKER_TIMEOUT}
restart: always
command: /docker-entrypoint.sh
environment:
- EXECUTIONS_TIMEOUT=19800
- EXECUTIONS_TIMEOUT_MAX=19800
- EXECUTIONS_DATA_SAVE_MANUAL_EXECUTIONS=true
- EXECUTIONS_DATA_PRUNE=true
# - EXECUTIONS_DATA_PRUNE_MAX_COUNT=5000
- EXECUTIONS_MODE=queue
- WEBHOOK_URL=http://localhost:5678/
ports:
- "5678:5678"
healthcheck:
test: [ "CMD-SHELL", "pg_isready -h localhost -U postgres -d ${DATABASE_DB}" ]
interval: 5s
timeout: 5s
retries: 10
depends_on:
- postgres
- redis
QUEUE_BULL_REDIS_HOST= localhost
QUEUE_BULL_REDIS_PORT= 6379
everything is define but n8n service is getting restart again and again.
Hey @Gouravdev,
Is n8n showing an error when you try to start it? I still don’t fully understand why you are using args when you can just use environments instead which is what we document, Looking at this thread I believe you have made your environment more complicated that it needs to be.
If you can provide the error you see from n8n we can work out where the issue could be, I suspect it could be that n8n can’t connect to redis if you are using localhost as your env option as that will be local to the container not local to the machine running n8n.
Thanks @Jon
ERROR
May you please share a working docker file in which redis is being used so that I can take the reference from it.
Also, please share the necessary environment variables which are required.
Also, how to get to know that the redis working on the system? is there any specific argument or parameter that reflects the the redis is working fine??
Hey @Gouravdev,
That error doesn’t look to be related to redis, it is saying the n8n command you are calling can’t be found.
I would recommend checking that the path is correct.
You can monitor redis like normal to make sure it is working but I suspect what you really want to know is if n8n is correctly running in queue mode, you can do this by checking the workers page in the ui if using n8n enterprise or by checking the worker console log.
I am also still not sure why you would add that to your docker file when it isn’t needed, you can just add a start command in your compose file and use worker.
I would also recommend that you review your docker files as your configuration looks like it has been made too complicated and it could be a lot cleaner.
- n8n is correctly running in queue mode, you can do this by checking the workers page in the ui if using n8n enterprise or by checking the worker console log.
- I am not using n8n enterprise so how I can check it in another way?
- What is expected console log response??
- I am also still not sure why you would add that to your docker file when it isn’t needed, you can just add a start command in your compose file and use worker.
- May you please tell how It can be done because I have tried but i am not able to do it.
@Jon thanks for your help, let me make the requirement more clear.
- I need a docker file, in which redis is working
- How to check the redis is working fine? how to check the logs?
- what changes are required for to make sure redis work fine?
Thanks