Skip to content

Instantly share code, notes, and snippets.

@singingwolfboy
Created September 19, 2016 18:35
Show Gist options
  • Save singingwolfboy/3daa650b11aa790c389139b8495b08a1 to your computer and use it in GitHub Desktop.
Save singingwolfboy/3daa650b11aa790c389139b8495b08a1 to your computer and use it in GitHub Desktop.
Can't recreate elasticsearch index
➜ micromasters git:(master) docker-compose run web ./manage.py recreate_index
Pulling elastic (elasticsearch:latest)...
latest: Pulling from library/elasticsearch
8ad8b3f87b37: Already exists
751fe39c4d34: Already exists
b165e84cccc1: Pull complete
acfcc7cbc59b: Pull complete
04b7a9efc4af: Pull complete
b16e55fe5285: Pull complete
8c5cbb866b55: Pull complete
53c3dd7fc70d: Pull complete
3de13756a8c8: Pull complete
64be422416b7: Pull complete
b808918635ce: Pull complete
5b3ceec8c156: Pull complete
561269d0b7cc: Pull complete
0c6cf9533753: Pull complete
Digest: sha256:0805f15d9dfa3ef5a32a0f43d3aad428adc0d6fa6576ffbcdd268f5ae40a4a2e
Status: Downloaded newer image for elasticsearch:latest
Pulling db (postgres:latest)...
latest: Pulling from library/postgres
8ad8b3f87b37: Already exists
c5f4a4b21ab6: Pull complete
ba05db8b0a52: Pull complete
47b491cd21ab: Pull complete
d70407e3e64d: Pull complete
295c246dd69f: Pull complete
89bc4bb8bcfd: Pull complete
106ff44c5f06: Pull complete
867cd91e76bb: Pull complete
a227948d6d8c: Pull complete
fc2ec20bdaf0: Pull complete
Digest: sha256:1115f095242a490cb79561124a79125e25b0595d5ae47d44fab5b4c1cd10735f
Status: Downloaded newer image for postgres:latest
Creating micromasters_db_1
Creating micromasters_elastic_1
System check identified some issues:
WARNINGS:
?: (1_8.W001) The standalone TEMPLATE_* settings were deprecated in Django 1.8 and the TEMPLATES dictionary takes precedence. You must put the values of the following settings into your default TEMPLATES dict: TEMPLATE_CONTEXT_PROCESSORS.
HEAD http://elastic:9200/micromasters [status:N/A request:0.008s]
Traceback (most recent call last):
File "/usr/local/lib/python3.5/site-packages/urllib3/connection.py", line 138, in _new_conn
(self.host, self.port), self.timeout, **extra_kw)
File "/usr/local/lib/python3.5/site-packages/urllib3/util/connection.py", line 98, in create_connection
raise err
File "/usr/local/lib/python3.5/site-packages/urllib3/util/connection.py", line 88, in create_connection
sock.connect(sa)
ConnectionRefusedError: [Errno 111] Connection refused
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.5/site-packages/elasticsearch/connection/http_urllib3.py", line 94, in perform_request
response = self.pool.urlopen(method, url, body, retries=False, headers=self.headers, **kw)
File "/usr/local/lib/python3.5/site-packages/urllib3/connectionpool.py", line 643, in urlopen
_stacktrace=sys.exc_info()[2])
File "/usr/local/lib/python3.5/site-packages/urllib3/util/retry.py", line 251, in increment
raise six.reraise(type(error), error, _stacktrace)
File "/usr/local/lib/python3.5/site-packages/urllib3/packages/six.py", line 686, in reraise
raise value
File "/usr/local/lib/python3.5/site-packages/urllib3/connectionpool.py", line 594, in urlopen
chunked=chunked)
File "/usr/local/lib/python3.5/site-packages/urllib3/connectionpool.py", line 361, in _make_request
conn.request(method, url, **httplib_request_kw)
File "/usr/local/lib/python3.5/http/client.py", line 1106, in request
self._send_request(method, url, body, headers)
File "/usr/local/lib/python3.5/http/client.py", line 1151, in _send_request
self.endheaders(body)
File "/usr/local/lib/python3.5/http/client.py", line 1102, in endheaders
self._send_output(message_body)
File "/usr/local/lib/python3.5/http/client.py", line 934, in _send_output
self.send(msg)
File "/usr/local/lib/python3.5/http/client.py", line 877, in send
self.connect()
File "/usr/local/lib/python3.5/site-packages/urllib3/connection.py", line 163, in connect
conn = self._new_conn()
File "/usr/local/lib/python3.5/site-packages/urllib3/connection.py", line 147, in _new_conn
self, "Failed to establish a new connection: %s" % e)
urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPConnection object at 0x7f9222c293c8>: Failed to establish a new connection: [Errno 111] Connection refused
HEAD http://elastic:9200/micromasters [status:N/A request:0.001s]
Traceback (most recent call last):
File "/usr/local/lib/python3.5/site-packages/urllib3/connection.py", line 138, in _new_conn
(self.host, self.port), self.timeout, **extra_kw)
File "/usr/local/lib/python3.5/site-packages/urllib3/util/connection.py", line 98, in create_connection
raise err
File "/usr/local/lib/python3.5/site-packages/urllib3/util/connection.py", line 88, in create_connection
sock.connect(sa)
ConnectionRefusedError: [Errno 111] Connection refused
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.5/site-packages/elasticsearch/connection/http_urllib3.py", line 94, in perform_request
response = self.pool.urlopen(method, url, body, retries=False, headers=self.headers, **kw)
File "/usr/local/lib/python3.5/site-packages/urllib3/connectionpool.py", line 643, in urlopen
_stacktrace=sys.exc_info()[2])
File "/usr/local/lib/python3.5/site-packages/urllib3/util/retry.py", line 251, in increment
raise six.reraise(type(error), error, _stacktrace)
File "/usr/local/lib/python3.5/site-packages/urllib3/packages/six.py", line 686, in reraise
raise value
File "/usr/local/lib/python3.5/site-packages/urllib3/connectionpool.py", line 594, in urlopen
chunked=chunked)
File "/usr/local/lib/python3.5/site-packages/urllib3/connectionpool.py", line 361, in _make_request
conn.request(method, url, **httplib_request_kw)
File "/usr/local/lib/python3.5/http/client.py", line 1106, in request
self._send_request(method, url, body, headers)
File "/usr/local/lib/python3.5/http/client.py", line 1151, in _send_request
self.endheaders(body)
File "/usr/local/lib/python3.5/http/client.py", line 1102, in endheaders
self._send_output(message_body)
File "/usr/local/lib/python3.5/http/client.py", line 934, in _send_output
self.send(msg)
File "/usr/local/lib/python3.5/http/client.py", line 877, in send
self.connect()
File "/usr/local/lib/python3.5/site-packages/urllib3/connection.py", line 163, in connect
conn = self._new_conn()
File "/usr/local/lib/python3.5/site-packages/urllib3/connection.py", line 147, in _new_conn
self, "Failed to establish a new connection: %s" % e)
urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPConnection object at 0x7f9222c294e0>: Failed to establish a new connection: [Errno 111] Connection refused
HEAD http://elastic:9200/micromasters [status:N/A request:0.000s]
Traceback (most recent call last):
File "/usr/local/lib/python3.5/site-packages/urllib3/connection.py", line 138, in _new_conn
(self.host, self.port), self.timeout, **extra_kw)
File "/usr/local/lib/python3.5/site-packages/urllib3/util/connection.py", line 98, in create_connection
raise err
File "/usr/local/lib/python3.5/site-packages/urllib3/util/connection.py", line 88, in create_connection
sock.connect(sa)
ConnectionRefusedError: [Errno 111] Connection refused
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.5/site-packages/elasticsearch/connection/http_urllib3.py", line 94, in perform_request
response = self.pool.urlopen(method, url, body, retries=False, headers=self.headers, **kw)
File "/usr/local/lib/python3.5/site-packages/urllib3/connectionpool.py", line 643, in urlopen
_stacktrace=sys.exc_info()[2])
File "/usr/local/lib/python3.5/site-packages/urllib3/util/retry.py", line 251, in increment
raise six.reraise(type(error), error, _stacktrace)
File "/usr/local/lib/python3.5/site-packages/urllib3/packages/six.py", line 686, in reraise
raise value
File "/usr/local/lib/python3.5/site-packages/urllib3/connectionpool.py", line 594, in urlopen
chunked=chunked)
File "/usr/local/lib/python3.5/site-packages/urllib3/connectionpool.py", line 361, in _make_request
conn.request(method, url, **httplib_request_kw)
File "/usr/local/lib/python3.5/http/client.py", line 1106, in request
self._send_request(method, url, body, headers)
File "/usr/local/lib/python3.5/http/client.py", line 1151, in _send_request
self.endheaders(body)
File "/usr/local/lib/python3.5/http/client.py", line 1102, in endheaders
self._send_output(message_body)
File "/usr/local/lib/python3.5/http/client.py", line 934, in _send_output
self.send(msg)
File "/usr/local/lib/python3.5/http/client.py", line 877, in send
self.connect()
File "/usr/local/lib/python3.5/site-packages/urllib3/connection.py", line 163, in connect
conn = self._new_conn()
File "/usr/local/lib/python3.5/site-packages/urllib3/connection.py", line 147, in _new_conn
self, "Failed to establish a new connection: %s" % e)
urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPConnection object at 0x7f9222c3ca58>: Failed to establish a new connection: [Errno 111] Connection refused
HEAD http://elastic:9200/micromasters [status:N/A request:0.000s]
Traceback (most recent call last):
File "/usr/local/lib/python3.5/site-packages/urllib3/connection.py", line 138, in _new_conn
(self.host, self.port), self.timeout, **extra_kw)
File "/usr/local/lib/python3.5/site-packages/urllib3/util/connection.py", line 98, in create_connection
raise err
File "/usr/local/lib/python3.5/site-packages/urllib3/util/connection.py", line 88, in create_connection
sock.connect(sa)
ConnectionRefusedError: [Errno 111] Connection refused
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.5/site-packages/elasticsearch/connection/http_urllib3.py", line 94, in perform_request
response = self.pool.urlopen(method, url, body, retries=False, headers=self.headers, **kw)
File "/usr/local/lib/python3.5/site-packages/urllib3/connectionpool.py", line 643, in urlopen
_stacktrace=sys.exc_info()[2])
File "/usr/local/lib/python3.5/site-packages/urllib3/util/retry.py", line 251, in increment
raise six.reraise(type(error), error, _stacktrace)
File "/usr/local/lib/python3.5/site-packages/urllib3/packages/six.py", line 686, in reraise
raise value
File "/usr/local/lib/python3.5/site-packages/urllib3/connectionpool.py", line 594, in urlopen
chunked=chunked)
File "/usr/local/lib/python3.5/site-packages/urllib3/connectionpool.py", line 361, in _make_request
conn.request(method, url, **httplib_request_kw)
File "/usr/local/lib/python3.5/http/client.py", line 1106, in request
self._send_request(method, url, body, headers)
File "/usr/local/lib/python3.5/http/client.py", line 1151, in _send_request
self.endheaders(body)
File "/usr/local/lib/python3.5/http/client.py", line 1102, in endheaders
self._send_output(message_body)
File "/usr/local/lib/python3.5/http/client.py", line 934, in _send_output
self.send(msg)
File "/usr/local/lib/python3.5/http/client.py", line 877, in send
self.connect()
File "/usr/local/lib/python3.5/site-packages/urllib3/connection.py", line 163, in connect
conn = self._new_conn()
File "/usr/local/lib/python3.5/site-packages/urllib3/connection.py", line 147, in _new_conn
self, "Failed to establish a new connection: %s" % e)
urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPConnection object at 0x7f92229dd4a8>: Failed to establish a new connection: [Errno 111] Connection refused
Traceback (most recent call last):
File "/usr/local/lib/python3.5/site-packages/urllib3/connection.py", line 138, in _new_conn
(self.host, self.port), self.timeout, **extra_kw)
File "/usr/local/lib/python3.5/site-packages/urllib3/util/connection.py", line 98, in create_connection
raise err
File "/usr/local/lib/python3.5/site-packages/urllib3/util/connection.py", line 88, in create_connection
sock.connect(sa)
ConnectionRefusedError: [Errno 111] Connection refused
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.5/site-packages/elasticsearch/connection/http_urllib3.py", line 94, in perform_request
response = self.pool.urlopen(method, url, body, retries=False, headers=self.headers, **kw)
File "/usr/local/lib/python3.5/site-packages/urllib3/connectionpool.py", line 643, in urlopen
_stacktrace=sys.exc_info()[2])
File "/usr/local/lib/python3.5/site-packages/urllib3/util/retry.py", line 251, in increment
raise six.reraise(type(error), error, _stacktrace)
File "/usr/local/lib/python3.5/site-packages/urllib3/packages/six.py", line 686, in reraise
raise value
File "/usr/local/lib/python3.5/site-packages/urllib3/connectionpool.py", line 594, in urlopen
chunked=chunked)
File "/usr/local/lib/python3.5/site-packages/urllib3/connectionpool.py", line 361, in _make_request
conn.request(method, url, **httplib_request_kw)
File "/usr/local/lib/python3.5/http/client.py", line 1106, in request
self._send_request(method, url, body, headers)
File "/usr/local/lib/python3.5/http/client.py", line 1151, in _send_request
self.endheaders(body)
File "/usr/local/lib/python3.5/http/client.py", line 1102, in endheaders
self._send_output(message_body)
File "/usr/local/lib/python3.5/http/client.py", line 934, in _send_output
self.send(msg)
File "/usr/local/lib/python3.5/http/client.py", line 877, in send
self.connect()
File "/usr/local/lib/python3.5/site-packages/urllib3/connection.py", line 163, in connect
conn = self._new_conn()
File "/usr/local/lib/python3.5/site-packages/urllib3/connection.py", line 147, in _new_conn
self, "Failed to establish a new connection: %s" % e)
urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPConnection object at 0x7f92229dd4a8>: Failed to establish a new connection: [Errno 111] Connection refused
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "./manage.py", line 14, in <module>
execute_from_command_line(sys.argv)
File "/usr/local/lib/python3.5/site-packages/django/core/management/__init__.py", line 353, in execute_from_command_line
utility.execute()
File "/usr/local/lib/python3.5/site-packages/django/core/management/__init__.py", line 345, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/usr/local/lib/python3.5/site-packages/django/core/management/base.py", line 348, in run_from_argv
self.execute(*args, **cmd_options)
File "/usr/local/lib/python3.5/site-packages/django/core/management/base.py", line 399, in execute
output = self.handle(*args, **options)
File "/src/search/management/commands/recreate_index.py", line 22, in handle
recreate_index()
File "/src/search/indexing_api.py", line 310, in recreate_index
clear_index()
File "/src/search/indexing_api.py", line 299, in clear_index
if conn.indices.exists(index_name):
File "/usr/local/lib/python3.5/site-packages/elasticsearch/client/utils.py", line 69, in _wrapped
return func(*args, params=params, **kwargs)
File "/usr/local/lib/python3.5/site-packages/elasticsearch/client/indices.py", line 226, in exists
params=params)
File "/usr/local/lib/python3.5/site-packages/elasticsearch/transport.py", line 329, in perform_request
status, headers, data = connection.perform_request(method, url, params, body, ignore=ignore, timeout=timeout)
File "/usr/local/lib/python3.5/site-packages/elasticsearch/connection/http_urllib3.py", line 105, in perform_request
raise ConnectionError('N/A', str(e), e)
elasticsearch.exceptions.ConnectionError: ConnectionError(<urllib3.connection.HTTPConnection object at 0x7f92229dd4a8>: Failed to establish a new connection: [Errno 111] Connection refused) caused by: NewConnectionError(<urllib3.connection.HTTPConnection object at 0x7f92229dd4a8>: Failed to establish a new connection: [Errno 111] Connection refused)
➜ micromasters git:(master) docker-compose run web ./manage.py recreate_index
System check identified some issues:
WARNINGS:
?: (1_8.W001) The standalone TEMPLATE_* settings were deprecated in Django 1.8 and the TEMPLATES dictionary takes precedence. You must put the values of the following settings into your default TEMPLATES dict: TEMPLATE_CONTEXT_PROCESSORS.
HEAD /micromasters [status:404 request:0.069s]
HEAD /micromasters/program_user [status:404 request:0.002s]
[2016-09-19 18:34:30] DEBUG 1 [django.db.backends] utils.py:89 - [8fa8074e0184] - (0.000) SELECT "dashboard_programenrollment"."id", "dashboard_programenrollment"."user_id", "dashboard_programenrollment"."program_id" FROM "dashboard_programenrollment"; args=()
Traceback (most recent call last):
File "/usr/local/lib/python3.5/site-packages/django/db/backends/utils.py", line 64, in execute
return self.cursor.execute(sql, params)
psycopg2.ProgrammingError: relation "dashboard_programenrollment" does not exist
LINE 1: ..., "dashboard_programenrollment"."program_id" FROM "dashboard...
^
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "./manage.py", line 14, in <module>
execute_from_command_line(sys.argv)
File "/usr/local/lib/python3.5/site-packages/django/core/management/__init__.py", line 353, in execute_from_command_line
utility.execute()
File "/usr/local/lib/python3.5/site-packages/django/core/management/__init__.py", line 345, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/usr/local/lib/python3.5/site-packages/django/core/management/base.py", line 348, in run_from_argv
self.execute(*args, **cmd_options)
File "/usr/local/lib/python3.5/site-packages/django/core/management/base.py", line 399, in execute
output = self.handle(*args, **options)
File "/src/search/management/commands/recreate_index.py", line 22, in handle
recreate_index()
File "/src/search/indexing_api.py", line 311, in recreate_index
index_program_enrolled_users(ProgramEnrollment.objects.iterator())
File "/src/search/indexing_api.py", line 125, in index_program_enrolled_users
chunk = list(islice(program_enrollments, chunk_size))
File "/usr/local/lib/python3.5/site-packages/django/db/models/query.py", line 52, in __iter__
results = compiler.execute_sql()
File "/usr/local/lib/python3.5/site-packages/django/db/models/sql/compiler.py", line 848, in execute_sql
cursor.execute(sql, params)
File "/usr/local/lib/python3.5/site-packages/django/db/backends/utils.py", line 79, in execute
return super(CursorDebugWrapper, self).execute(sql, params)
File "/usr/local/lib/python3.5/site-packages/django/db/backends/utils.py", line 64, in execute
return self.cursor.execute(sql, params)
File "/usr/local/lib/python3.5/site-packages/django/db/utils.py", line 95, in __exit__
six.reraise(dj_exc_type, dj_exc_value, traceback)
File "/usr/local/lib/python3.5/site-packages/django/utils/six.py", line 685, in reraise
raise value.with_traceback(tb)
File "/usr/local/lib/python3.5/site-packages/django/db/backends/utils.py", line 64, in execute
return self.cursor.execute(sql, params)
django.db.utils.ProgrammingError: relation "dashboard_programenrollment" does not exist
LINE 1: ..., "dashboard_programenrollment"."program_id" FROM "dashboard...
^
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment