本文主要是介绍zun.common.exception pymysql.err.DataError 1406, “Data too long for column ‘exposed_ports‘ at row 1“,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
openstack中管理容器暴露范围端口,转换为单个端口,端口暴露包括 tcp和udp 协议,出现个数过多,数据过长,zun-api请求报错如下:
2021-10-21 19:14:49.926 2925 ERROR zun.common.exception [req-b037140d-79d6-4a91-9fcd-926321baf4b1 - - - - -] ab065d5e-faf3-4e28-b88b-551336ab3985:(pymysql.err.DataError) (1406, “Data too long for column ‘exposed_ports’ at row 1”)
[SQL: INSERT INTO container (created_at, updated_at, project_id, user_id, uuid, container_id, name, image, cpu, cpu_policy, cpuset, command, memory, status, status_reason, task_state, environment, workdir, ports, hostname, labels, meta, addresses, image_pull_policy, host, restart_policy, status_detail, interactive, tty, image_driver, websocket_url, websocket_token, security_groups, auto_remove, runtime, disk, auto_heal, capsule_id, started_at, privileged, healthcheck, exposed_ports, registry_id, container_type) VALUES (%(created_at)s, %(updated_at)s, %(project_id)s, %(user_id)s, %(uuid)s, %(container_id)s, %(name)s, %(image)s, %(cpu)s, %(cpu_policy)s, %(cpuset)s, %(command)s, %(memory)s, %(status)s, %(status_reason)s, %(task_state)s, %(environment)s, %(workdir)s, %(ports)s, %(hostname)s, %(labels)s, %(meta)s, %(addresses)s, %(image_pull_policy)s, %(host)s, %(restart_policy)s, %(status_detail)s, %(interactive)s, %(tty)s, %(image_driver)s, %(websocket_url)s, %(websocket_token)s, %(security_groups)s, %(auto_remove)s, %(runtime)s, %(disk)s, %(auto_heal)s, %(capsule_id)s, %(started_at)s, %(privileged)s, %(healthcheck)s, %(exposed_ports)s, %(registry_id)s, %(container_type)s)]
[parameters: {‘created_at’: datetime.datetime(2021, 10, 21, 11, 14, 49, 195735), ‘updated_at’: None, ‘project_id’: ‘cb5388a3555346d0b224b45a1fc0aa2e’, ‘user_id’: ‘8e949daa55634ef48777ecd989daa6ab’, ‘uuid’: ‘78a36eee-c370-4415-b473-4ad28425f94c’, ‘container_id’: None, ‘name’: ‘9be5e7ba0fb840ed9b36eed483c2af10’, ‘image’: ‘d30a9dbc-1f75-4179-8f66-cca641848277’, ‘cpu’: 2.0, ‘cpu_policy’: ‘shared’, ‘cpuset’: b’{}’, ‘command’: b’[]’, ‘memory’: ‘1024’, ‘status’: ‘Creating’, ‘status_reason’: None, ‘task_state’: None, ‘environment’: b’{“USERNAME”: “admin111”, “PASSWORD”: “ppp@ssw0rd”, “BASEPATH”: “/bbbbb001”, “HOOKJS”: “/obama.js”, “WEBPORT”: “4444/tcp”, “ssh_port”: “22/tcp”, “HTT … (4 characters truncated) … XY”: “6789/tcp”, “NAT_SERVER_TOKEN”: “e0ee37bf-1257-40fc-9682-0ac98e6f60b5”, “NAT_SERVER_ADDR”: “192.168.1.1”, “NAT_CLIENT_EXPOSE_PORT”: “5678-9999”}’, ‘workdir’: None, ‘ports’: b’[]’, ‘hostname’: ‘beef’, ‘labels’: b’{}’, ‘meta’: b’{}’, ‘addresses’: b’{}’, ‘image_pull_policy’: None, ‘host’: None, ‘restart_policy’: b’{}’, ‘status_detail’: None, ‘interactive’: 1, ‘tty’: 1, ‘image_driver’: ‘glance’, ‘websocket_url’: None, ‘websocket_token’: None, ‘security_groups’: b’[]’, ‘auto_remove’: 0, ‘runtime’: ‘runc’, ‘disk’: 5, ‘auto_heal’: 0, ‘capsule_id’: None, ‘started_at’: None, ‘privileged’: 1, ‘healthcheck’: b’{}’, ‘exposed_ports’: b’{“4444/tcp”: {}, “22/tcp”: {}, “6789/tcp”: {}, “5678/tcp”: {}, “5678/udp”: {}, “5679/tcp”: {}, “5679/udp”: {}, “5680/tcp”: {}, “5680/udp”: {}, "5681 … (138037 characters truncated) … : {}, “9995/udp”: {}, “9996/tcp”: {}, “9996/udp”: {}, “9997/tcp”: {}, “9997/udp”: {}, “9998/tcp”: {}, “9998/udp”: {}, “9999/tcp”: {}, “9999/udp”: {}}’, ‘registry_id’: None, ‘container_type’: 0}]
(Background on this error at: http://sqlalche.me/e/9h9h): oslo_db.exception.DBDataError: (pymysql.err.DataError) (1406, “Data too long for column ‘exposed_ports’ at row 1”)
[SQL: INSERT INTO container (created_at, updated_at, project_id, user_id, uuid, container_id, name, image, cpu, cpu_policy, cpuset, command, memory, status, status_reason, task_state, environment, workdir, ports, hostname, labels, meta, addresses, image_pull_policy, host, restart_policy, status_detail, interactive, tty, image_driver, websocket_url, websocket_token, security_groups, auto_remove, runtime, disk, auto_heal, capsule_id, started_at, privileged, healthcheck, exposed_ports, registry_id, container_type) VALUES (%(created_at)s, %(updated_at)s, %(project_id)s, %(user_id)s, %(uuid)s, %(container_id)s, %(name)s, %(image)s, %(cpu)s, %(cpu_policy)s, %(cpuset)s, %(command)s, %(memory)s, %(status)s, %(status_reason)s, %(task_state)s, %(environment)s, %(workdir)s, %(ports)s, %(hostname)s, %(labels)s, %(meta)s, %(addresses)s, %(image_pull_policy)s, %(host)s, %(restart_policy)s, %(status_detail)s, %(interactive)s, %(tty)s, %(image_driver)s, %(websocket_url)s, %(websocket_token)s, %(security_groups)s, %(auto_remove)s, %(runtime)s, %(disk)s, %(auto_heal)s, %(capsule_id)s, %(started_at)s, %(privileged)s, %(healthcheck)s, %(exposed_ports)s, %(registry_id)s, %(container_type)s)]
[parameters: {‘created_at’: datetime.datetime(2021, 10, 21, 11, 14, 49, 195735), ‘updated_at’: None, ‘project_id’: ‘cb5388a3555346d0b224b45a1fc0aa2e’, ‘user_id’: ‘8e949daa55634ef48777ecd989daa6ab’, ‘uuid’: ‘78a36eee-c370-4415-b473-4ad28425f94c’, ‘container_id’: None, ‘name’: ‘9be5e7ba0fb840ed9b36eed483c2af10’, ‘image’: ‘d30a9dbc-1f75-4179-8f66-cca641848277’, ‘cpu’: 2.0, ‘cpu_policy’: ‘shared’, ‘cpuset’: b’{}’, ‘command’: b’[]’, ‘memory’: ‘1024’, ‘status’: ‘Creating’, ‘status_reason’: None, ‘task_state’: None, ‘environment’: b’{“USERNAME”: “admin111”, “PASSWORD”: “ppp@ssw0rd”, “BASEPATH”: “/bbbbb001”, “HOOKJS”: “/obama.js”, “WEBPORT”: “4444/tcp”, “ssh_port”: “22/tcp”, “HTT … (4 characters truncated) … XY”: “6789/tcp”, “NAT_SERVER_TOKEN”: “e0ee37bf-1257-40fc-9682-0ac98e6f60b5”, “NAT_SERVER_ADDR”: “192.168.1.1”, “NAT_CLIENT_EXPOSE_PORT”: “5678-9999”}’, ‘workdir’: None, ‘ports’: b’[]’, ‘hostname’: ‘beef’, ‘labels’: b’{}’, ‘meta’: b’{}’, ‘addresses’: b’{}’, ‘image_pull_policy’: None, ‘host’: None, ‘restart_policy’: b’{}’, ‘status_detail’: None, ‘interactive’: 1, ‘tty’: 1, ‘image_driver’: ‘glance’, ‘websocket_url’: None, ‘websocket_token’: None, ‘security_groups’: b’[]’, ‘auto_remove’: 0, ‘runtime’: ‘runc’, ‘disk’: 5, ‘auto_heal’: 0, ‘capsule_id’: None, ‘started_at’: None, ‘privileged’: 1, ‘healthcheck’: b’{}’, ‘exposed_ports’: b’{“4444/tcp”: {}, “22/tcp”: {}, “6789/tcp”: {}, “5678/tcp”: {}, “5678/udp”: {}, “5679/tcp”: {}, “5679/udp”: {}, “5680/tcp”: {}, “5680/udp”: {}, "5681 … (138037 characters truncated) … : {}, “9995/udp”: {}, “9996/tcp”: {}, “9996/udp”: {}, “9997/tcp”: {}, “9997/udp”: {}, “9998/tcp”: {}, “9998/udp”: {}, “9999/tcp”: {}, “9999/udp”: {}}’, ‘registry_id’: None, ‘container_type’: 0}]
(Background on this error at: http://sqlalche.me/e/9h9h)
2021-10-21 19:14:49.926 2925 ERROR zun.common.exception Traceback (most recent call last):
2021-10-21 19:14:49.926 2925 ERROR zun.common.exception File “/usr/local/lib64/python3.6/site-packages/sqlalchemy/engine/base.py”, line 1249, in _execute_context
2021-10-21 19:14:49.926 2925 ERROR zun.common.exception cursor, statement, parameters, context
2021-10-21 19:14:49.926 2925 ERROR zun.common.exception File “/usr/local/lib64/python3.6/site-packages/sqlalchemy/engine/default.py”, line 552, in do_execute
2021-10-21 19:14:49.926 2925 ERROR zun.common.exception cursor.execute(statement, parameters)
2021-10-21 19:14:49.926 2925 ERROR zun.common.exception File “/usr/local/lib/python3.6/site-packages/pymysql/cursors.py”, line 170, in execute
2021-10-21 19:14:49.926 2925 ERROR zun.common.exception result = self._query(query)
2021-10-21 19:14:49.926 2925 ERROR zun.common.exception File “/usr/local/lib/python3.6/site-packages/pymysql/cursors.py”, line 328, in _query
2021-10-21 19:14:49.926 2925 ERROR zun.common.exception conn.query(q)
2021-10-21 19:14:49.926 2925 ERROR zun.common.exception File “/usr/local/lib/python3.6/site-packages/pymysql/connections.py”, line 517, in query
2021-10-21 19:14:49.926 2925 ERROR zun.common.exception self._affected_rows = self._read_query_result(unbuffered=unbuffered)
2021-10-21 19:14:49.926 2925 ERROR zun.common.exception File “/usr/local/lib/python3.6/site-packages/pymysql/connections.py”, line 732, in _read_query_result
2021-10-21 19:14:49.926 2925 ERROR zun.common.exception result.read()
2021-10-21 19:14:49.926 2925 ERROR zun.common.exception File “/usr/local/lib/python3.6/site-packages/pymysql/connections.py”, line 1075, in read
2021-10-21 19:14:49.926 2925 ERROR zun.common.exception first_packet = self.connection._read_packet()
2021-10-21 19:14:49.926 2925 ERROR zun.common.exception File “/usr/local/lib/python3.6/site-packages/pymysql/connections.py”, line 684, in _read_packet
2021-10-21 19:14:49.926 2925 ERROR zun.common.exception packet.check_error()
2021-10-21 19:14:49.926 2925 ERROR zun.common.exception File “/usr/local/lib/python3.6/site-packages/pymysql/protocol.py”, line 220, in check_error
2021-10-21 19:14:49.926 2925 ERROR zun.common.exception err.raise_mysql_exception(self._data)
2021-10-21 19:14:49.926 2925 ERROR zun.common.exception File “/usr/local/lib/python3.6/site-packages/pymysql/err.py”, line 109, in raise_mysql_exception
2021-10-21 19:14:49.926 2925 ERROR zun.common.exception raise errorclass(errno, errval)
2021-10-21 19:14:49.926 2925 ERROR zun.common.exception pymysql.err.DataError: (1406, “Data too long for column ‘exposed_ports’ at row 1”)
2021-10-21 19:14:49.926 2925 ERROR zun.common.exception
2021-10-21 19:14:49.926 2925 ERROR zun.common.exception The above exception was the direct cause of the following exception:
2021-10-21 19:14:49.926 2925 ERROR zun.common.exception
2021-10-21 19:14:49.926 2925 ERROR zun.common.exception Traceback (most recent call last):
2021-10-21 19:14:49.926 2925 ERROR zun.common.exception File “/usr/local/lib/python3.6/site-packages/zun/common/exception.py”, line 110, in wrapped
2021-10-21 19:14:49.926 2925 ERROR zun.common.exception return func(*args, **kwargs)
2021-10-21 19:14:49.926 2925 ERROR zun.common.exception File “/usr/local/lib/python3.6/site-packages/zun/api/validation/init.py”, line 55, in wrapper
2021-10-21 19:14:49.926 2925 ERROR zun.common.exception return func(*args, **kwargs)
2021-10-21 19:14:49.926 2925 ERROR zun.common.exception File “/usr/local/lib/python3.6/site-packages/zun/api/validation/init.py”, line 33, in wrapper
2021-10-21 19:14:49.926 2925 ERROR zun.common.exception return func(*args, **kwargs)
2021-10-21 19:14:49.926 2925 ERROR zun.common.exception File “/usr/local/lib/python3.6/site-packages/zun/api/controllers/v1/containers.py”, line 286, in post
2021-10-21 19:14:49.926 2925 ERROR zun.common.exception return self._do_post(run, **container_dict)
2021-10-21 19:14:49.926 2925 ERROR zun.common.exception File “/usr/local/lib/python3.6/site-packages/zun/api/controllers/v1/containers.py”, line 413, in _do_post
2021-10-21 19:14:49.926 2925 ERROR zun.common.exception new_container.create(context)
2021-10-21 19:14:49.926 2925 ERROR zun.common.exception File “/usr/local/lib/python3.6/site-packages/oslo_versionedobjects/base.py”, line 226, in wrapper
2021-10-21 19:14:49.926 2925 ERROR zun.common.exception return fn(self, *args, **kwargs)
2021-10-21 19:14:49.926 2925 ERROR zun.common.exception File “/usr/local/lib/python3.6/site-packages/zun/objects/container.py”, line 239, in create
2021-10-21 19:14:49.926 2925 ERROR zun.common.exception db_container = dbapi.create_container(context, values)
2021-10-21 19:14:49.926 2925 ERROR zun.common.exception File “/usr/local/lib/python3.6/site-packages/osprofiler/profiler.py”, line 160, in wrapper
2021-10-21 19:14:49.926 2925 ERROR zun.common.exception result = f(*args, **kwargs)
2021-10-21 19:14:49.926 2925 ERROR zun.common.exception File “/usr/local/lib/python3.6/site-packages/zun/db/api.py”, line 80, in create_container
2021-10-21 19:14:49.926 2925 ERROR zun.common.exception return _get_dbdriver_instance().create_container(context, values)
2021-10-21 19:14:49.926 2925 ERROR zun.common.exception File “/usr/local/lib/python3.6/site-packages/zun/db/sqlalchemy/api.py”, line 204, in create_container
2021-10-21 19:14:49.926 2925 ERROR zun.common.exception container.save()
2021-10-21 19:14:49.926 2925 ERROR zun.common.exception File “/usr/local/lib/python3.6/site-packages/zun/db/sqlalchemy/models.py”, line 104, in save
2021-10-21 19:14:49.926 2925 ERROR zun.common.exception super(ZunBase, self).save(session)
2021-10-21 19:14:49.926 2925 ERROR zun.common.exception File “/usr/local/lib/python3.6/site-packages/oslo_db/sqlalchemy/models.py”, line 48, in save
2021-10-21 19:14:49.926 2925 ERROR zun.common.exception session.flush()
2021-10-21 19:14:49.926 2925 ERROR zun.common.exception File “/usr/local/lib64/python3.6/site-packages/sqlalchemy/orm/session.py”, line 2459, in flush
2021-10-21 19:14:49.926 2925 ERROR zun.common.exception self._flush(objects)
2021-10-21 19:14:49.926 2925 ERROR zun.common.exception File “/usr/local/lib64/python3.6/site-packages/sqlalchemy/orm/session.py”, line 2597, in _flush
2021-10-21 19:14:49.926 2925 ERROR zun.common.exception transaction.rollback(_capture_exception=True)
2021-10-21 19:14:49.926 2925 ERROR zun.common.exception File “/usr/local/lib64/python3.6/site-packages/sqlalchemy/util/langhelpers.py”, line 68, in exit
2021-10-21 19:14:49.926 2925 ERROR zun.common.exception compat.reraise(exc_type, exc_value, exc_tb)
2021-10-21 19:14:49.926 2925 ERROR zun.common.exception File “/usr/local/lib64/python3.6/site-packages/sqlalchemy/util/compat.py”, line 153, in reraise
2021-10-21 19:14:49.926 2925 ERROR zun.common.exception raise value
2021-10-21 19:14:49.926 2925 ERROR zun.common.exception File “/usr/local/lib64/python3.6/site-packages/sqlalchemy/orm/session.py”, line 2557, in _flush
2021-10-21 19:14:49.926 2925 ERROR zun.common.exception flush_context.execute()
2021-10-21 19:14:49.926 2925 ERROR zun.common.exception File “/usr/local/lib64/python3.6/site-packages/sqlalchemy/orm/unitofwork.py”, line 422, in execute
2021-10-21 19:14:49.926 2925 ERROR zun.common.exception rec.execute(self)
2021-10-21 19:14:49.926 2925 ERROR zun.common.exception File “/usr/local/lib64/python3.6/site-packages/sqlalchemy/orm/unitofwork.py”, line 589, in execute
2021-10-21 19:14:49.926 2925 ERROR zun.common.exception uow,
2021-10-21 19:14:49.926 2925 ERROR zun.common.exception File “/usr/local/lib64/python3.6/site-packages/sqlalchemy/orm/persistence.py”, line 245, in save_obj
2021-10-21 19:14:49.926 2925 ERROR zun.common.exception insert,
2021-10-21 19:14:49.926 2925 ERROR zun.common.exception File “/usr/local/lib64/python3.6/site-packages/sqlalchemy/orm/persistence.py”, line 1138, in _emit_insert_statements
2021-10-21 19:14:49.926 2925 ERROR zun.common.exception statement, params
2021-10-21 19:14:49.926 2925 ERROR zun.common.exception File “/usr/local/lib64/python3.6/site-packages/sqlalchemy/engine/base.py”, line 988, in execute
2021-10-21 19:14:49.926 2925 ERROR zun.common.exception return meth(self, multiparams, params)
2021-10-21 19:14:49.926 2925 ERROR zun.common.exception File “/usr/local/lib64/python3.6/site-packages/sqlalchemy/sql/elements.py”, line 287, in _execute_on_connection
2021-10-21 19:14:49.926 2925 ERROR zun.common.exception return connection._execute_clauseelement(self, multiparams, params)
2021-10-21 19:14:49.926 2925 ERROR zun.common.exception File “/usr/local/lib64/python3.6/site-packages/sqlalchemy/engine/base.py”, line 1107, in _execute_clauseelement
2021-10-21 19:14:49.926 2925 ERROR zun.common.exception distilled_params,
2021-10-21 19:14:49.926 2925 ERROR zun.common.exception File “/usr/local/lib64/python3.6/site-packages/sqlalchemy/engine/base.py”, line 1253, in _execute_context
2021-10-21 19:14:49.926 2925 ERROR zun.common.exception e, statement, parameters, cursor, context
2021-10-21 19:14:49.926 2925 ERROR zun.common.exception File “/usr/local/lib64/python3.6/site-packages/sqlalchemy/engine/base.py”, line 1471, in _handle_dbapi_exception
2021-10-21 19:14:49.926 2925 ERROR zun.common.exception util.raise_from_cause(newraise, exc_info)
2021-10-21 19:14:49.926 2925 ERROR zun.common.exception File “/usr/local/lib64/python3.6/site-packages/sqlalchemy/util/compat.py”, line 398, in raise_from_cause
2021-10-21 19:14:49.926 2925 ERROR zun.common.exception reraise(type(exception), exception, tb=exc_tb, cause=cause)
2021-10-21 19:14:49.926 2925 ERROR zun.common.exception File “/usr/local/lib64/python3.6/site-packages/sqlalchemy/util/compat.py”, line 152, in reraise
2021-10-21 19:14:49.926 2925 ERROR zun.common.exception raise value.with_traceback(tb)
2021-10-21 19:14:49.926 2925 ERROR zun.common.exception File “/usr/local/lib64/python3.6/site-packages/sqlalchemy/engine/base.py”, line 1249, in _execute_context
2021-10-21 19:14:49.926 2925 ERROR zun.common.exception cursor, statement, parameters, context
2021-10-21 19:14:49.926 2925 ERROR zun.common.exception File “/usr/local/lib64/python3.6/site-packages/sqlalchemy/engine/default.py”, line 552, in do_execute
2021-10-21 19:14:49.926 2925 ERROR zun.common.exception cursor.execute(statement, parameters)
2021-10-21 19:14:49.926 2925 ERROR zun.common.exception File “/usr/local/lib/python3.6/site-packages/pymysql/cursors.py”, line 170, in execute
2021-10-21 19:14:49.926 2925 ERROR zun.common.exception result = self._query(query)
2021-10-21 19:14:49.926 2925 ERROR zun.common.exception File “/usr/local/lib/python3.6/site-packages/pymysql/cursors.py”, line 328, in _query
2021-10-21 19:14:49.926 2925 ERROR zun.common.exception conn.query(q)
2021-10-21 19:14:49.926 2925 ERROR zun.common.exception File “/usr/local/lib/python3.6/site-packages/pymysql/connections.py”, line 517, in query
2021-10-21 19:14:49.926 2925 ERROR zun.common.exception self._affected_rows = self._read_query_result(unbuffered=unbuffered)
2021-10-21 19:14:49.926 2925 ERROR zun.common.exception File “/usr/local/lib/python3.6/site-packages/pymysql/connections.py”, line 732, in _read_query_result
2021-10-21 19:14:49.926 2925 ERROR zun.common.exception result.read()
2021-10-21 19:14:49.926 2925 ERROR zun.common.exception File “/usr/local/lib/python3.6/site-packages/pymysql/connections.py”, line 1075, in read
2021-10-21 19:14:49.926 2925 ERROR zun.common.exception first_packet = self.connection._read_packet()
2021-10-21 19:14:49.926 2925 ERROR zun.common.exception File “/usr/local/lib/python3.6/site-packages/pymysql/connections.py”, line 684, in _read_packet
2021-10-21 19:14:49.926 2925 ERROR zun.common.exception packet.check_error()
2021-10-21 19:14:49.926 2925 ERROR zun.common.exception File “/usr/local/lib/python3.6/site-packages/pymysql/protocol.py”, line 220, in check_error
2021-10-21 19:14:49.926 2925 ERROR zun.common.exception err.raise_mysql_exception(self._data)
2021-10-21 19:14:49.926 2925 ERROR zun.common.exception File “/usr/local/lib/python3.6/site-packages/pymysql/err.py”, line 109, in raise_mysql_exception
2021-10-21 19:14:49.926 2925 ERROR zun.common.exception raise errorclass(errno, errval)
2021-10-21 19:14:49.926 2925 ERROR zun.common.exception oslo_db.exception.DBDataError: (pymysql.err.DataError) (1406, “Data too long for column ‘exposed_ports’ at row 1”)
2021-10-21 19:14:49.926 2925 ERROR zun.common.exception [SQL: INSERT INTO container (created_at, updated_at, project_id, user_id, uuid, container_id, name, image, cpu, cpu_policy, cpuset, command, memory, status, status_reason, task_state, environment, workdir, ports, hostname, labels, meta, addresses, image_pull_policy, host, restart_policy, status_detail, interactive, tty, image_driver, websocket_url, websocket_token, security_groups, auto_remove, runtime, disk, auto_heal, capsule_id, started_at, privileged, healthcheck, exposed_ports, registry_id, container_type) VALUES (%(created_at)s, %(updated_at)s, %(project_id)s, %(user_id)s, %(uuid)s, %(container_id)s, %(name)s, %(image)s, %(cpu)s, %(cpu_policy)s, %(cpuset)s, %(command)s, %(memory)s, %(status)s, %(status_reason)s, %(task_state)s, %(environment)s, %(workdir)s, %(ports)s, %(hostname)s, %(labels)s, %(meta)s, %(addresses)s, %(image_pull_policy)s, %(host)s, %(restart_policy)s, %(status_detail)s, %(interactive)s, %(tty)s, %(image_driver)s, %(websocket_url)s, %(websocket_token)s, %(security_groups)s, %(auto_remove)s, %(runtime)s, %(disk)s, %(auto_heal)s, %(capsule_id)s, %(started_at)s, %(privileged)s, %(healthcheck)s, %(exposed_ports)s, %(registry_id)s, %(container_type)s)]
2021-10-21 19:14:49.926 2925 ERROR zun.common.exception [parameters: {‘created_at’: datetime.datetime(2021, 10, 21, 11, 14, 49, 195735), ‘updated_at’: None, ‘project_id’: ‘cb5388a3555346d0b224b45a1fc0aa2e’, ‘user_id’: ‘8e949daa55634ef48777ecd989daa6ab’, ‘uuid’: ‘78a36eee-c370-4415-b473-4ad28425f94c’, ‘container_id’: None, ‘name’: ‘9be5e7ba0fb840ed9b36eed483c2af10’, ‘image’: ‘d30a9dbc-1f75-4179-8f66-cca641848277’, ‘cpu’: 2.0, ‘cpu_policy’: ‘shared’, ‘cpuset’: b’{}’, ‘command’: b’[]’, ‘memory’: ‘1024’, ‘status’: ‘Creating’, ‘status_reason’: None, ‘task_state’: None, ‘environment’: b’{“USERNAME”: “admin111”, “PASSWORD”: “ppp@ssw0rd”, “BASEPATH”: “/bbbbb001”, “HOOKJS”: “/obama.js”, “WEBPORT”: “4444/tcp”, “ssh_port”: “22/tcp”, “HTT … (4 characters truncated) … XY”: “6789/tcp”, “NAT_SERVER_TOKEN”: “e0ee37bf-1257-40fc-9682-0ac98e6f60b5”, “NAT_SERVER_ADDR”: “192.168.1.1”, “NAT_CLIENT_EXPOSE_PORT”: “5678-9999”}’, ‘workdir’: None, ‘ports’: b’[]’, ‘hostname’: ‘beef’, ‘labels’: b’{}’, ‘meta’: b’{}’, ‘addresses’: b’{}’, ‘image_pull_policy’: None, ‘host’: None, ‘restart_policy’: b’{}’, ‘status_detail’: None, ‘interactive’: 1, ‘tty’: 1, ‘image_driver’: ‘glance’, ‘websocket_url’: None, ‘websocket_token’: None, ‘security_groups’: b’[]’, ‘auto_remove’: 0, ‘runtime’: ‘runc’, ‘disk’: 5, ‘auto_heal’: 0, ‘capsule_id’: None, ‘started_at’: None, ‘privileged’: 1, ‘healthcheck’: b’{}’, ‘exposed_ports’: b’{“4444/tcp”: {}, “22/tcp”: {}, “6789/tcp”: {}, “5678/tcp”: {}, “5678/udp”: {}, “5679/tcp”: {}, “5679/udp”: {}, “5680/tcp”: {}, “5680/udp”: {}, "5681 … (138037 characters truncated) … : {}, “9995/udp”: {}, “9996/tcp”: {}, “9996/udp”: {}, “9997/tcp”: {}, “9997/udp”: {}, “9998/tcp”: {}, “9998/udp”: {}, “9999/tcp”: {}, “9999/udp”: {}}’, ‘registry_id’: None, ‘container_type’: 0}]
2021-10-21 19:14:49.926 2925 ERROR zun.common.exception (Background on this error at: http://sqlalche.me/e/9h9h)
2021-10-21 19:14:49.926 2925 ERROR zun.common.exception
解决方法:
一、查看数据库设计,限制数据长度,也就是限制端口暴露的个数或者端口的范围大小:
mysql -uroot -p
use zun;
show tables;
desc container;
可以看到 exposed_ports 字段类型为 text 类型,在mysql中不同类型支持的长度如下:
TINYTEXT 256 bytes
TEXT 65,535 bytes ~64kb
MEDIUMTEXT 16,777,215 bytes ~16MB
LONGTEXT 4,294,967,295 bytes ~4GB
因此,你可以手动修改对应的数据表字段类型,但是一般不建议这么做。
可以采用在应用层做限制,根据 text 字段的长度,可以计算出支持的端口个数或者范围。
二、把容器的端口暴露改为关联一个安全组,安全组中添加若干个安全组规则,从而避免容器调用直接提供的参数暴露长度限制。
人生总有那么几步路需要自己鼓起勇气走完~
这篇关于zun.common.exception pymysql.err.DataError 1406, “Data too long for column ‘exposed_ports‘ at row 1“的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!