我正在尝试借助this link
安装哨兵在运行此命令后正在运行迁移标题下
createdb -E utf-8 sentry
它要求我安装postgresql-client-common
,我是通过此命令安装的
sudo apt install postgresql-client-common
此后,当我尝试运行createdb -E utf-8 sentry
时收到此消息
Warning: No existing local cluster is suitable as a default target. Please see man pg_wrapper(1) how to specify one.
Error: You must install at least one postgresql-client-<version> package
运行命令
后,出现异常sentry upgrade
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/sentry/options/store.py", line 165, in get_store
value = self.model.objects.get(key=key.name).value
File "/usr/local/lib/python2.7/dist-packages/django/db/models/manager.py", line 151, in get
return self.get_queryset().get(*args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/django/db/models/query.py", line 304, in get
num = len(clone)
File "/usr/local/lib/python2.7/dist-packages/django/db/models/query.py", line 77, in __len__
self._fetch_all()
File "/usr/local/lib/python2.7/dist-packages/django/db/models/query.py", line 857, in _fetch_all
self._result_cache = list(self.iterator())
File "/usr/local/lib/python2.7/dist-packages/django/db/models/query.py", line 220, in iterator
for row in compiler.results_iter():
File "/usr/local/lib/python2.7/dist-packages/django/db/models/sql/compiler.py", line 713, in results_iter
for rows in self.execute_sql(MULTI):
File "/usr/local/lib/python2.7/dist-packages/django/db/models/sql/compiler.py", line 785, in execute_sql
cursor = self.connection.cursor()
File "/usr/local/lib/python2.7/dist-packages/django/db/backends/__init__.py", line 162, in cursor
cursor = util.CursorWrapper(self._cursor(), self)
File "/usr/local/lib/python2.7/dist-packages/sentry/db/postgres/decorators.py", line 44, in inner
return func(self, *args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/sentry/db/postgres/base.py", line 84, in _cursor
cursor = super(DatabaseWrapper, self)._cursor()
File "/usr/local/lib/python2.7/dist-packages/django/db/backends/__init__.py", line 132, in _cursor
self.ensure_connection()
File "/usr/local/lib/python2.7/dist-packages/django/db/backends/__init__.py", line 127, in ensure_connection
self.connect()
File "/usr/local/lib/python2.7/dist-packages/django/db/utils.py", line 99, in __exit__
six.reraise(dj_exc_type, dj_exc_value, traceback)
File "/usr/local/lib/python2.7/dist-packages/django/db/backends/__init__.py", line 127, in ensure_connection
self.connect()
File "/usr/local/lib/python2.7/dist-packages/django/db/backends/__init__.py", line 115, in connect
self.connection = self.get_new_connection(conn_params)
File "/usr/local/lib/python2.7/dist-packages/django/db/backends/postgresql_psycopg2/base.py", line 115, in get_new_connection
return Database.connect(**conn_params)
File "/usr/local/lib/python2.7/dist-packages/psycopg2/__init__.py", line 130, in connect
conn = _connect(dsn, connection_factory=connection_factory, **kwasync)
OperationalError: could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?
12:21:31 [ERROR] sentry: option.failed-lookup (key=u'system.url-prefix')
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/sentry/options/store.py", line 165, in get_store
value = self.model.objects.get(key=key.name).value
File "/usr/local/lib/python2.7/dist-packages/django/db/models/manager.py", line 151, in get
return self.get_queryset().get(*args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/django/db/models/query.py", line 304, in get
num = len(clone)
File "/usr/local/lib/python2.7/dist-packages/django/db/models/query.py", line 77, in __len__
self._fetch_all()
File "/usr/local/lib/python2.7/dist-packages/django/db/models/query.py", line 857, in _fetch_all
self._result_cache = list(self.iterator())
File "/usr/local/lib/python2.7/dist-packages/django/db/models/query.py", line 220, in iterator
for row in compiler.results_iter():
File "/usr/local/lib/python2.7/dist-packages/django/db/models/sql/compiler.py", line 713, in results_iter
for rows in self.execute_sql(MULTI):
File "/usr/local/lib/python2.7/dist-packages/django/db/models/sql/compiler.py", line 785, in execute_sql
cursor = self.connection.cursor()
File "/usr/local/lib/python2.7/dist-packages/django/db/backends/__init__.py", line 162, in cursor
cursor = util.CursorWrapper(self._cursor(), self)
File "/usr/local/lib/python2.7/dist-packages/sentry/db/postgres/decorators.py", line 44, in inner
return func(self, *args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/sentry/db/postgres/base.py", line 84, in _cursor
cursor = super(DatabaseWrapper, self)._cursor()
File "/usr/local/lib/python2.7/dist-packages/django/db/backends/__init__.py", line 132, in _cursor
self.ensure_connection()
File "/usr/local/lib/python2.7/dist-packages/django/db/backends/__init__.py", line 127, in ensure_connection
self.connect()
File "/usr/local/lib/python2.7/dist-packages/django/db/utils.py", line 99, in __exit__
six.reraise(dj_exc_type, dj_exc_value, traceback)
File "/usr/local/lib/python2.7/dist-packages/django/db/backends/__init__.py", line 127, in ensure_connection
self.connect()
File "/usr/local/lib/python2.7/dist-packages/django/db/backends/__init__.py", line 115, in connect
self.connection = self.get_new_connection(conn_params)
File "/usr/local/lib/python2.7/dist-packages/django/db/backends/postgresql_psycopg2/base.py", line 115, in get_new_connection
return Database.connect(**conn_params)
File "/usr/local/lib/python2.7/dist-packages/psycopg2/__init__.py", line 130, in connect
conn = _connect(dsn, connection_factory=connection_factory, **kwasync)
OperationalError: could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?
12:21:31 [INFO] sentry.utils.raven.SentryInternalClient: Not capturing exception due to filters: <class 'django.db.utils.OperationalError'>
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/sentry/options/store.py", line 165, in get_store
value = self.model.objects.get(key=key.name).value
File "/usr/local/lib/python2.7/dist-packages/django/db/models/manager.py", line 151, in get
return self.get_queryset().get(*args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/django/db/models/query.py", line 304, in get
num = len(clone)
File "/usr/local/lib/python2.7/dist-packages/django/db/models/query.py", line 77, in __len__
self._fetch_all()
File "/usr/local/lib/python2.7/dist-packages/django/db/models/query.py", line 857, in _fetch_all
self._result_cache = list(self.iterator())
File "/usr/local/lib/python2.7/dist-packages/django/db/models/query.py", line 220, in iterator
for row in compiler.results_iter():
File "/usr/local/lib/python2.7/dist-packages/django/db/models/sql/compiler.py", line 713, in results_iter
for rows in self.execute_sql(MULTI):
File "/usr/local/lib/python2.7/dist-packages/django/db/models/sql/compiler.py", line 785, in execute_sql
cursor = self.connection.cursor()
File "/usr/local/lib/python2.7/dist-packages/django/db/backends/__init__.py", line 162, in cursor
cursor = util.CursorWrapper(self._cursor(), self)
File "/usr/local/lib/python2.7/dist-packages/sentry/db/postgres/decorators.py", line 44, in inner
return func(self, *args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/sentry/db/postgres/base.py", line 84, in _cursor
cursor = super(DatabaseWrapper, self)._cursor()
File "/usr/local/lib/python2.7/dist-packages/django/db/backends/__init__.py", line 132, in _cursor
self.ensure_connection()
File "/usr/local/lib/python2.7/dist-packages/django/db/backends/__init__.py", line 127, in ensure_connection
self.connect()
File "/usr/local/lib/python2.7/dist-packages/django/db/utils.py", line 99, in __exit__
six.reraise(dj_exc_type, dj_exc_value, traceback)
File "/usr/local/lib/python2.7/dist-packages/django/db/backends/__init__.py", line 127, in ensure_connection
self.connect()
File "/usr/local/lib/python2.7/dist-packages/django/db/backends/__init__.py", line 115, in connect
self.connection = self.get_new_connection(conn_params)
File "/usr/local/lib/python2.7/dist-packages/django/db/backends/postgresql_psycopg2/base.py", line 115, in get_new_connection
return Database.connect(**conn_params)
File "/usr/local/lib/python2.7/dist-packages/psycopg2/__init__.py", line 130, in connect
conn = _connect(dsn, connection_factory=connection_factory, **kwasync)
OperationalError: could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?
12:21:31 [ERROR] sentry: option.failed-lookup (key=u'system.url-prefix')
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/sentry/options/store.py", line 165, in get_store
value = self.model.objects.get(key=key.name).value
File "/usr/local/lib/python2.7/dist-packages/django/db/models/manager.py", line 151, in get
return self.get_queryset().get(*args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/django/db/models/query.py", line 304, in get
num = len(clone)
File "/usr/local/lib/python2.7/dist-packages/django/db/models/query.py", line 77, in __len__
self._fetch_all()
File "/usr/local/lib/python2.7/dist-packages/django/db/models/query.py", line 857, in _fetch_all
self._result_cache = list(self.iterator())
File "/usr/local/lib/python2.7/dist-packages/django/db/models/query.py", line 220, in iterator
for row in compiler.results_iter():
File "/usr/local/lib/python2.7/dist-packages/django/db/models/sql/compiler.py", line 713, in results_iter
for rows in self.execute_sql(MULTI):
File "/usr/local/lib/python2.7/dist-packages/django/db/models/sql/compiler.py", line 785, in execute_sql
cursor = self.connection.cursor()
File "/usr/local/lib/python2.7/dist-packages/django/db/backends/__init__.py", line 162, in cursor
cursor = util.CursorWrapper(self._cursor(), self)
File "/usr/local/lib/python2.7/dist-packages/sentry/db/postgres/decorators.py", line 44, in inner
return func(self, *args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/sentry/db/postgres/base.py", line 84, in _cursor
cursor = super(DatabaseWrapper, self)._cursor()
File "/usr/local/lib/python2.7/dist-packages/django/db/backends/__init__.py", line 132, in _cursor
self.ensure_connection()
File "/usr/local/lib/python2.7/dist-packages/django/db/backends/__init__.py", line 127, in ensure_connection
self.connect()
File "/usr/local/lib/python2.7/dist-packages/django/db/utils.py", line 99, in __exit__
six.reraise(dj_exc_type, dj_exc_value, traceback)
File "/usr/local/lib/python2.7/dist-packages/django/db/backends/__init__.py", line 127, in ensure_connection
self.connect()
File "/usr/local/lib/python2.7/dist-packages/django/db/backends/__init__.py", line 115, in connect
self.connection = self.get_new_connection(conn_params)
File "/usr/local/lib/python2.7/dist-packages/django/db/backends/postgresql_psycopg2/base.py", line 115, in get_new_connection
return Database.connect(**conn_params)
File "/usr/local/lib/python2.7/dist-packages/psycopg2/__init__.py", line 130, in connect
conn = _connect(dsn, connection_factory=connection_factory, **kwasync)
OperationalError: could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?
12:21:31 [INFO] sentry.utils.raven.SentryInternalClient: Not capturing exception due to filters: <class 'django.db.utils.OperationalError'>
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/sentry/utils/metrics.py", line 64, in worker
tsdb.incr(tsdb.models.internal, full_key, count=amount)
File "/usr/local/lib/python2.7/dist-packages/sentry/utils/services.py", line 91, in <lambda>
context[key] = (lambda f: lambda *a, **k: getattr(self, f)(*a, **k))(key)
File "/usr/local/lib/python2.7/dist-packages/sentry/tsdb/redis.py", line 214, in incr
self.incr_multi([(model, key)], timestamp, count, environment_id)
File "/usr/local/lib/python2.7/dist-packages/sentry/tsdb/redis.py", line 239, in incr_multi
client.hincrby(hash_key, hash_field, count)
File "/usr/local/lib/python2.7/dist-packages/redis/client.py", line 1865, in hincrby
return self.execute_command('HINCRBY', name, key, amount)
File "/usr/local/lib/python2.7/dist-packages/rb/clients.py", line 333, in execute_command
buf = self._get_command_buffer(host_id, args[0])
File "/usr/local/lib/python2.7/dist-packages/rb/clients.py", line 351, in _get_command_buffer
buf = CommandBuffer(host_id, connect, self.auto_batch)
File "/usr/local/lib/python2.7/dist-packages/rb/clients.py", line 90, in __init__
self.connect()
File "/usr/local/lib/python2.7/dist-packages/rb/clients.py", line 109, in connect
self.connection.connect()
File "/usr/local/lib/python2.7/dist-packages/redis/connection.py", line 442, in connect
raise ConnectionError(self._error_message(e))
ConnectionError: Error 111 connecting to 127.0.0.1:6379. Connection refused.
12:21:31 [ERROR] sentry.errors: Unable to incr internal metric
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/sentry/utils/metrics.py", line 64, in worker
tsdb.incr(tsdb.models.internal, full_key, count=amount)
File "/usr/local/lib/python2.7/dist-packages/sentry/utils/services.py", line 91, in <lambda>
context[key] = (lambda f: lambda *a, **k: getattr(self, f)(*a, **k))(key)
File "/usr/local/lib/python2.7/dist-packages/sentry/tsdb/redis.py", line 214, in incr
self.incr_multi([(model, key)], timestamp, count, environment_id)
File "/usr/local/lib/python2.7/dist-packages/sentry/tsdb/redis.py", line 239, in incr_multi
client.hincrby(hash_key, hash_field, count)
File "/usr/local/lib/python2.7/dist-packages/redis/client.py", line 1865, in hincrby
return self.execute_command('HINCRBY', name, key, amount)
File "/usr/local/lib/python2.7/dist-packages/rb/clients.py", line 333, in execute_command
buf = self._get_command_buffer(host_id, args[0])
File "/usr/local/lib/python2.7/dist-packages/rb/clients.py", line 351, in _get_command_buffer
buf = CommandBuffer(host_id, connect, self.auto_batch)
File "/usr/local/lib/python2.7/dist-packages/rb/clients.py", line 90, in __init__
self.connect()
File "/usr/local/lib/python2.7/dist-packages/rb/clients.py", line 109, in connect
self.connection.connect()
File "/usr/local/lib/python2.7/dist-packages/redis/connection.py", line 442, in connect
raise ConnectionError(self._error_message(e))
ConnectionError: Error 111 connecting to 127.0.0.1:6379. Connection refused.
12:21:31 [ERROR] sentry.errors: Unable to incr internal metric
Error in sys.excepthook:
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/raven/base.py", line 274, in handle_exception
self.captureException(exc_info=exc_info, level='fatal')
File "/usr/local/lib/python2.7/dist-packages/raven/base.py", line 814, in captureException
'raven.events.Exception', exc_info=exc_info, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/sentry/utils/raven.py", line 46, in capture
return super(SentryInternalClient, self).capture(*args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/raven/contrib/django/client.py", line 297, in capture
result = super(DjangoClient, self).capture(event_type, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/raven/base.py", line 641, in capture
self.send(**data)
File "/usr/local/lib/python2.7/dist-packages/sentry/utils/raven.py", line 75, in send
key = ProjectKey.get_default(settings.SENTRY_PROJECT)
File "/usr/local/lib/python2.7/dist-packages/sentry/models/projectkey.py", line 121, in get_default
)[0]
File "/usr/local/lib/python2.7/dist-packages/django/db/models/query.py", line 132, in __getitem__
return list(qs)[0]
File "/usr/local/lib/python2.7/dist-packages/django/db/models/query.py", line 96, in __iter__
self._fetch_all()
File "/usr/local/lib/python2.7/dist-packages/django/db/models/query.py", line 857, in _fetch_all
self._result_cache = list(self.iterator())
File "/usr/local/lib/python2.7/dist-packages/django/db/models/query.py", line 220, in iterator
for row in compiler.results_iter():
File "/usr/local/lib/python2.7/dist-packages/django/db/models/sql/compiler.py", line 713, in results_iter
for rows in self.execute_sql(MULTI):
File "/usr/local/lib/python2.7/dist-packages/django/db/models/sql/compiler.py", line 785, in execute_sql
cursor = self.connection.cursor()
File "/usr/local/lib/python2.7/dist-packages/django/db/backends/__init__.py", line 162, in cursor
cursor = util.CursorWrapper(self._cursor(), self)
File "/usr/local/lib/python2.7/dist-packages/sentry/db/postgres/decorators.py", line 44, in inner
return func(self, *args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/sentry/db/postgres/base.py", line 84, in _cursor
cursor = super(DatabaseWrapper, self)._cursor()
File "/usr/local/lib/python2.7/dist-packages/django/db/backends/__init__.py", line 132, in _cursor
self.ensure_connection()
File "/usr/local/lib/python2.7/dist-packages/django/db/backends/__init__.py", line 127, in ensure_connection
self.connect()
File "/usr/local/lib/python2.7/dist-packages/django/db/utils.py", line 99, in __exit__
six.reraise(dj_exc_type, dj_exc_value, traceback)
File "/usr/local/lib/python2.7/dist-packages/django/db/backends/__init__.py", line 127, in ensure_connection
self.connect()
File "/usr/local/lib/python2.7/dist-packages/django/db/backends/__init__.py", line 115, in connect
self.connection = self.get_new_connection(conn_params)
File "/usr/local/lib/python2.7/dist-packages/django/db/backends/postgresql_psycopg2/base.py", line 115, in get_new_connection
return Database.connect(**conn_params)
File "/usr/local/lib/python2.7/dist-packages/psycopg2/__init__.py", line 130, in connect
conn = _connect(dsn, connection_factory=connection_factory, **kwasync)
django.db.utils.OperationalError: could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?
Original exception was:
Traceback (most recent call last):
File "/usr/local/bin/sentry", line 11, in <module>
sys.exit(main())
File "/usr/local/lib/python2.7/dist-packages/sentry/runner/__init__.py", line 162, in main
cli(prog_name=get_prog(), obj={}, max_content_width=100)
File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 722, in __call__
return self.main(*args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 697, in main
rv = self.invoke(ctx)
File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 1066, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 895, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 535, in invoke
return callback(*args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/click/decorators.py", line 17, in new_func
return f(get_current_context(), *args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/sentry/runner/decorators.py", line 35, in inner
configure()
File "/usr/local/lib/python2.7/dist-packages/sentry/runner/__init__.py", line 125, in configure
configure(ctx, py, yaml, skip_service_validation)
File "/usr/local/lib/python2.7/dist-packages/sentry/runner/settings.py", line 152, in configure
skip_service_validation=skip_service_validation
File "/usr/local/lib/python2.7/dist-packages/sentry/runner/initializer.py", line 321, in initialize_app
setup_services(validate=not skip_service_validation)
File "/usr/local/lib/python2.7/dist-packages/sentry/runner/initializer.py", line 344, in setup_services
service.validate()
File "/usr/local/lib/python2.7/dist-packages/sentry/utils/services.py", line 91, in <lambda>
context[key] = (lambda f: lambda *a, **k: getattr(self, f)(*a, **k))(key)
File "/usr/local/lib/python2.7/dist-packages/sentry/buffer/redis.py", line 71, in validate
raise InvalidConfiguration(six.text_type(e))
sentry.exceptions.InvalidConfiguration: Error 111 connecting to 127.0.0.1:6379. Connection refused.
除了config.yml中的config.yml
外,我没有更改这些文件sentry.conf.py
和mail.backend: 'dummy'
的内容
这是sentry.conf.py
的内容import os.path
CONF_ROOT = os.path.dirname(__file__)
DATABASES = {
'default': {
'ENGINE': 'sentry.db.postgres',
'NAME': 'sentry',
'USER': 'postgres',
'PASSWORD': '',
'HOST': '',
'PORT': '',
'AUTOCOMMIT': True,
'ATOMIC_REQUESTS': False,
}
}
SENTRY_USE_BIG_INTS = True
SENTRY_SINGLE_ORGANIZATION = True
DEBUG = False
SENTRY_CACHE = 'sentry.cache.redis.RedisCache'
BROKER_URL = 'redis://localhost:6379'
SENTRY_RATELIMITER = 'sentry.ratelimits.redis.RedisRateLimiter'
SENTRY_BUFFER = 'sentry.buffer.redis.RedisBuffer'
SENTRY_QUOTAS = 'sentry.quotas.redis.RedisQuota'
SENTRY_TSDB = 'sentry.tsdb.redis.RedisTSDB'
SENTRY_DIGESTS = 'sentry.digests.backends.redis.RedisBackend'
SENTRY_WEB_HOST = '0.0.0.0'
SENTRY_WEB_PORT = 9000
SENTRY_WEB_OPTIONS = {
}
config.yml
mail.backend: 'dummy' # Use dummy if you want to disable email entirely
system.secret-key: 'iur********************'
redis.clusters:
default:
hosts:
0:
host: 127.0.0.1
port: 6379
filestore.backend: 'filesystem'
filestore.options:
location: '/tmp/sentry-files'
为了简化起见,我从两个文件中都删除了注释部分。什么原因可能导致此异常?
我是哨兵的初学者,我也不熟悉postgresql