Somehow I can not get sentry to work when using a password for redis.
Without redis password set it works without problem.
However, when I set a password for redis (By this I mean I set a password on the redis server and then I configure the same password in sentry.conf.py)
The according block in sentry.conf.py looks almost like in the setup guide:
SENTRY_REDIS_OPTIONS = {
'hosts': {
0: {
'host': '127.0.0.1',
'port': 6379,
'password': 'mypassword'
}
}
}
When trying to start sentry celery worker it prints this error message:
[2016-02-08 18:28:07,421: ERROR/MainProcess] consumer: Cannot connect to redis://localhost:6379//: .
Trying again in 2.00 seconds...
and stack traces like this:
[ERROR] Unable to record event:
Event was: u'consumer: Cannot connect to redis://localhost:6379//: .\nTrying again in 2.00 seconds...\n'
Traceback (most recent call last):
File "/var/www/sentry/sentry/local/lib/python2.7/site-packages/sentry/utils/raven.py", line 86, in send
helper.insert_data_to_database(data)
File "/var/www/sentry/sentry/local/lib/python2.7/site-packages/sentry/coreapi.py", line 591, in insert_data_to_database
preprocess_event.delay(cache_key=cache_key, start_time=time())
File "/var/www/sentry/sentry/local/lib/python2.7/site-packages/celery/app/task.py", line 453, in delay
return self.apply_async(args, kwargs)
File "/var/www/sentry/sentry/local/lib/python2.7/site-packages/sentry/celery.py", line 44, in apply_async
return OriginalTask.apply_async(self, *args, **kwargs)
File "/var/www/sentry/sentry/local/lib/python2.7/site-packages/celery/app/task.py", line 559, in apply_async
**dict(self._get_exec_options(), **options)
File "/var/www/sentry/sentry/local/lib/python2.7/site-packages/celery/app/base.py", line 353, in send_task
reply_to=reply_to or self.oid, **options
File "/var/www/sentry/sentry/local/lib/python2.7/site-packages/celery/app/amqp.py", line 305, in publish_task
**kwargs
File "/var/www/sentry/sentry/local/lib/python2.7/site-packages/kombu/messaging.py", line 172, in publish
routing_key, mandatory, immediate, exchange, declare)
File "/var/www/sentry/sentry/local/lib/python2.7/site-packages/kombu/connection.py", line 457, in _ensured
interval_max)
File "/var/www/sentry/sentry/local/lib/python2.7/site-packages/kombu/connection.py", line 369, in ensure_connection
interval_start, interval_step, interval_max, callback)
File "/var/www/sentry/sentry/local/lib/python2.7/site-packages/kombu/utils/__init__.py", line 246, in retry_over_time
return fun(*args, **kwargs)
File "/var/www/sentry/sentry/local/lib/python2.7/site-packages/kombu/connection.py", line 237, in connect
return self.connection
File "/var/www/sentry/sentry/local/lib/python2.7/site-packages/kombu/connection.py", line 741, in connection
self._connection = self._establish_connection()
File "/var/www/sentry/sentry/local/lib/python2.7/site-packages/kombu/connection.py", line 696, in _establish_connection
conn = self.transport.establish_connection()
File "/var/www/sentry/sentry/local/lib/python2.7/site-packages/kombu/transport/virtual/__init__.py", line 809, in establish_connection
self._avail_channels.append(self.create_channel(self))
File "/var/www/sentry/sentry/local/lib/python2.7/site-packages/kombu/transport/virtual/__init__.py", line 791, in create_channel
channel = self.Channel(connection)
File "/var/www/sentry/sentry/local/lib/python2.7/site-packages/kombu/transport/redis.py", line 456, in __init__
self._pool.disconnect()
File "/var/www/sentry/sentry/local/lib/python2.7/site-packages/redis/connection.py", line 921, in disconnect
connection.disconnect()
File "/var/www/sentry/sentry/local/lib/python2.7/site-packages/kombu/transport/redis.py", line 819, in disconnect
channel._on_connection_disconnect(self)
File "/var/www/sentry/sentry/local/lib/python2.7/site-packages/kombu/transport/redis.py", line 476, in _on_connection_disconnect
raise get_redis_ConnectionError()
ConnectionError
at every connection attempt.
When I intentionally set a wrong password in sentry.conf.py, I get an exception
sentry.exceptions.InvalidConfiguration: NOAUTH Authentication required. as expected.
I'm not sure if I'm missing some configuration or if this is an error in sentry :question:
Sentry Version is 8.1.2
I dont have a lot of experience with redis.
As mentioned, the Error-Message is
[2016-02-08 18:30:51,150: ERROR/MainProcess] consumer: Cannot connect to redis://localhost:6379//: .
Trying again in 26.00 seconds...
Shouldn't the URL contain the redis password, something like: redis://:password@hostname:port?
Hey @iv-mexx, so the error that you pointed out is coming from the connection for the queue. That comes from BROKER_URL. So in your case, you'd need to use the format you pointed out there. Also documented here: http://docs.celeryproject.org/en/latest/getting-started/brokers/redis.html#configuration
Thanks for the quick help @mattrobenolt, its now working! :+1:
I updated our docs too to clarify this since it was slightly counter intuitive imo. Thanks for pointing it out.
馃憤
If someone stumbles upon this thread: the password for Redis can be set using the environment variable SENTRY_REDIS_PASSWORD
Most helpful comment
If someone stumbles upon this thread: the password for Redis can be set using the environment variable SENTRY_REDIS_PASSWORD