veops / cmdb

CMDB: configuration and management of IT resources
https://veops.cn/cmdb
GNU Affero General Public License v3.0
1.47k stars 381 forks source link

登录失败问题 #12

Closed caicai19900921 closed 1 year ago

caicai19900921 commented 5 years ago

每一次成功的,各种接口报错

pycook commented 5 years ago

我刚clone下来代码,按README提示安装了一次,完全ok

你需要在根目录创建logs目录,但是这个报错很明显!

如果你ok了麻烦close这个问题

caicai19900921 commented 5 years ago

提示创建目录,这步没问题的,前端/后端启动都没问题,见截图 image image 登陆出现接口报错:

caicai19900921 commented 5 years ago

image

pycook commented 5 years ago

@caicai19900921 你能看看login failed请求的url是什么吗 还有response是什么

caicai19900921 commented 5 years ago

image image

pycook commented 5 years ago

@caicai19900921 因为我没有windows的开发环境,还不能重现,看起来请求都没到服务端,如果到了控制台会有log,应该是跨域导致的问题,你先升级一下浏览器版本。不行的话我找时间在windows环境下测试一下。。。

caicai19900921 commented 5 years ago

说说我的环境: 安装cmdb服务服务器:系统Centos7.5 访问cmdb客户端:win7

pycook commented 5 years ago

@caicai19900921 那问题很明显了, README里的install只适用于单机开发环境

前端访问不了后端的api!!!

解决方法:

  1. ui/.env里要替换127.0.0.1这个地址为你后端服务的ip地址
  2. 后端服务启动方法: pipenv run flask run -h 0.0.0.0
pycook commented 5 years ago

最快最便捷的方式是: docker-compose up -d

前提是启动了docker服务,安装了docker-compose

浏览器访问http://主机IP:8000

eyou257 commented 4 years ago

最快最便捷的方式是: docker-compose up -d

前提是启动了docker服务,安装了docker-compose

浏览器访问http://主机IP:8000 完全是通过docker安装的, 页面可以打开,但是登陆的时候 报“Request error, please try again later”

pycook commented 4 years ago

@eyou257 这个问题你要看看cmdb-api容器正常启动没?启动后看看api的log是否有error,如果是连接es错误,你把docker-compose文件里的sleep 20设置更长一点,用docker-compose重新启动一下

还解决不了的话,你如果不是第一次用docker构建这个cmdb,你最好把db的数据要重新导入一下,因为schema有过变更

pycook commented 4 years ago

对于docker启动,连接ES的错误已经被 #40 Fix了

SHYYCQ commented 4 years ago

我将我最终成功部署的经历分享如下,希望对后来者有用:

这几天使用windows、centos、debian多种操作系统各种方式尝试部署,部署完成后测试登录时总是报错request error。同事用debian虚拟机尝试部署成功,但那个虚拟机有些与此项目无直接关系的恶性Bug。之后,我改用docker部署,还是报错。目前,我查看#40 fix的历史代码和该issue的讨论记录,将docker-compose.yml里的sleep的值由5改成100后再重用docker部署,使用浏览器chrome 77.0.3865.90(windows系统自带的IE 11.592.18362.0不能正常访问登录页面:账户密码输入框不可见)登录成功并能正常工作。

CHN-STUDENT commented 4 years ago

@pycook 我在 centos7.6 虚拟机上使用docker部署,在同一局域网下的 win10 上同样无法访问。 查阅 API 日志

--------------------------------------------------------
 docker-compose-wait 2.7.3
---------------------------
Starting with configuration:
 - Hosts to be waiting for: [cmdb-db:3306, cmdb-cache:6379, cmdb-search:9200]
 - Timeout before failure: 30 seconds 
 - TCP connection timeout before retry: 5 seconds 
 - Sleeping time before checking for hosts availability: 0 seconds
 - Sleeping time once all hosts are available: 0 seconds
 - Sleeping time between retries: 1 seconds
--------------------------------------------------------
Checking availability of cmdb-db:3306
Host cmdb-db:3306 is now available!
--------------------------------------------------------
Checking availability of  cmdb-cache:6379
Host  cmdb-cache:6379 is now available!
--------------------------------------------------------
Checking availability of  cmdb-search:9200
Host  cmdb-search:9200 not yet available...
Host  cmdb-search:9200 not yet available...
Host  cmdb-search:9200 not yet available...
Host  cmdb-search:9200 not yet available...
Host  cmdb-search:9200 not yet available...
Host  cmdb-search:9200 not yet available...
Host  cmdb-search:9200 not yet available...
Host  cmdb-search:9200 not yet available...
Host  cmdb-search:9200 not yet available...
Host  cmdb-search:9200 not yet available...
Host  cmdb-search:9200 not yet available...
Host  cmdb-search:9200 not yet available...
Host  cmdb-search:9200 not yet available...
Host  cmdb-search:9200 not yet available...
Host  cmdb-search:9200 not yet available...
Host  cmdb-search:9200 not yet available...
Host  cmdb-search:9200 not yet available...
Host  cmdb-search:9200 not yet available...
Host  cmdb-search:9200 not yet available...
Host  cmdb-search:9200 not yet available...
Host  cmdb-search:9200 not yet available...
Host  cmdb-search:9200 not yet available...
Host  cmdb-search:9200 not yet available...
Host  cmdb-search:9200 not yet available...
Host  cmdb-search:9200 not yet available...
Host  cmdb-search:9200 not yet available...
Host  cmdb-search:9200 not yet available...
Host  cmdb-search:9200 not yet available...
Host  cmdb-search:9200 not yet available...
Host  cmdb-search:9200 not yet available...
Host  cmdb-search:9200 not yet available...
Timeout! After 30 seconds some hosts are still not reachable
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/urllib3/connection.py", line 157, in _new_conn
    (self._dns_host, self.port), self.timeout, **extra_kw
  File "/usr/local/lib/python3.7/site-packages/urllib3/util/connection.py", line 84, in create_connection
    raise err
  File "/usr/local/lib/python3.7/site-packages/urllib3/util/connection.py", line 74, 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.7/site-packages/elasticsearch/connection/http_urllib3.py", line 233, in perform_request
    method, url, body, retries=Retry(False), headers=request_headers, **kw
  File "/usr/local/lib/python3.7/site-packages/urllib3/connectionpool.py", line 720, in urlopen
    method, url, error=e, _pool=self, _stacktrace=sys.exc_info()[2]
  File "/usr/local/lib/python3.7/site-packages/urllib3/util/retry.py", line 376, in increment
    raise six.reraise(type(error), error, _stacktrace)
  File "/usr/local/lib/python3.7/site-packages/urllib3/packages/six.py", line 735, in reraise
    raise value
  File "/usr/local/lib/python3.7/site-packages/urllib3/connectionpool.py", line 672, in urlopen
    chunked=chunked,
  File "/usr/local/lib/python3.7/site-packages/urllib3/connectionpool.py", line 387, in _make_request
    conn.request(method, url, **httplib_request_kw)
  File "/usr/local/lib/python3.7/http/client.py", line 1252, in request
    self._send_request(method, url, body, headers, encode_chunked)
  File "/usr/local/lib/python3.7/http/client.py", line 1298, in _send_request
    self.endheaders(body, encode_chunked=encode_chunked)
  File "/usr/local/lib/python3.7/http/client.py", line 1247, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
  File "/usr/local/lib/python3.7/http/client.py", line 1026, in _send_output
    self.send(msg)
  File "/usr/local/lib/python3.7/http/client.py", line 966, in send
    self.connect()
  File "/usr/local/lib/python3.7/site-packages/urllib3/connection.py", line 184, in connect
    conn = self._new_conn()
  File "/usr/local/lib/python3.7/site-packages/urllib3/connection.py", line 169, in _new_conn
    self, "Failed to establish a new connection: %s" % e
urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPConnection object at 0x7fe33ee05b50>: 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 "/usr/local/bin/flask", line 8, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.7/site-packages/flask/cli.py", line 906, in main
    cli.main(args=args, prog_name=name)
  File "/usr/local/lib/python3.7/site-packages/flask/cli.py", line 569, in main
    return super(FlaskGroup, self).main(*args, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/click/core.py", line 782, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python3.7/site-packages/click/core.py", line 1254, in invoke
    cmd_name, cmd, args = self.resolve_command(ctx, args)
  File "/usr/local/lib/python3.7/site-packages/click/core.py", line 1297, in resolve_command
    cmd = self.get_command(ctx, cmd_name)
  File "/usr/local/lib/python3.7/site-packages/flask/cli.py", line 526, in get_command
    rv = info.load_app().cli.get_command(ctx, name)
  File "/usr/local/lib/python3.7/site-packages/flask/cli.py", line 381, in load_app
    app = locate_app(self, import_name, name)
  File "/usr/local/lib/python3.7/site-packages/flask/cli.py", line 236, in locate_app
    __import__(module_name)
  File "/data/apps/cmdb/autoapp.py", line 9, in <module>
    app = create_app()
  File "/data/apps/cmdb/api/app.py", line 82, in create_app
    register_extensions(app)
  File "/data/apps/cmdb/api/app.py", line 103, in register_extensions
    es.init_app(app)
  File "/data/apps/cmdb/api/lib/utils.py", line 110, in init_app
    if not self.es.indices.exists(index=self.index):
  File "/usr/local/lib/python3.7/site-packages/elasticsearch/client/utils.py", line 84, in _wrapped
    return func(*args, params=params, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/elasticsearch/client/indices.py", line 273, in exists
    return self.transport.perform_request("HEAD", _make_path(index), params=params)
  File "/usr/local/lib/python3.7/site-packages/elasticsearch/transport.py", line 350, in perform_request
    timeout=timeout,
  File "/usr/local/lib/python3.7/site-packages/elasticsearch/connection/http_urllib3.py", line 245, in perform_request
    raise ConnectionError("N/A", str(e), e)
elasticsearch.exceptions.ConnectionError: ConnectionError(<urllib3.connection.HTTPConnection object at 0x7fe33ee05b50>: Failed to establish a new connection: [Errno 111] Connection refused) caused by: NewConnectionError(<urllib3.connection.HTTPConnection object at 0x7fe33ee05b50>: Failed to establish a new connection: [Errno 111] Connection refused)
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/urllib3/connection.py", line 157, in _new_conn
    (self._dns_host, self.port), self.timeout, **extra_kw
  File "/usr/local/lib/python3.7/site-packages/urllib3/util/connection.py", line 84, in create_connection
    raise err
  File "/usr/local/lib/python3.7/site-packages/urllib3/util/connection.py", line 74, 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.7/site-packages/elasticsearch/connection/http_urllib3.py", line 233, in perform_request
    method, url, body, retries=Retry(False), headers=request_headers, **kw
  File "/usr/local/lib/python3.7/site-packages/urllib3/connectionpool.py", line 720, in urlopen
    method, url, error=e, _pool=self, _stacktrace=sys.exc_info()[2]
  File "/usr/local/lib/python3.7/site-packages/urllib3/util/retry.py", line 376, in increment
    raise six.reraise(type(error), error, _stacktrace)
  File "/usr/local/lib/python3.7/site-packages/urllib3/packages/six.py", line 735, in reraise
    raise value
  File "/usr/local/lib/python3.7/site-packages/urllib3/connectionpool.py", line 672, in urlopen
    chunked=chunked,
  File "/usr/local/lib/python3.7/site-packages/urllib3/connectionpool.py", line 387, in _make_request
    conn.request(method, url, **httplib_request_kw)
  File "/usr/local/lib/python3.7/http/client.py", line 1252, in request
    self._send_request(method, url, body, headers, encode_chunked)
  File "/usr/local/lib/python3.7/http/client.py", line 1298, in _send_request
    self.endheaders(body, encode_chunked=encode_chunked)
  File "/usr/local/lib/python3.7/http/client.py", line 1247, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
  File "/usr/local/lib/python3.7/http/client.py", line 1026, in _send_output
    self.send(msg)
  File "/usr/local/lib/python3.7/http/client.py", line 966, in send
    self.connect()
  File "/usr/local/lib/python3.7/site-packages/urllib3/connection.py", line 184, in connect
    conn = self._new_conn()
  File "/usr/local/lib/python3.7/site-packages/urllib3/connection.py", line 169, in _new_conn
    self, "Failed to establish a new connection: %s" % e
urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPConnection object at 0x7f5530ba2f10>: 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 "/usr/local/bin/flask", line 8, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.7/site-packages/flask/cli.py", line 906, in main
    cli.main(args=args, prog_name=name)
  File "/usr/local/lib/python3.7/site-packages/flask/cli.py", line 569, in main
    return super(FlaskGroup, self).main(*args, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/click/core.py", line 782, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python3.7/site-packages/click/core.py", line 1254, in invoke
    cmd_name, cmd, args = self.resolve_command(ctx, args)
  File "/usr/local/lib/python3.7/site-packages/click/core.py", line 1297, in resolve_command
    cmd = self.get_command(ctx, cmd_name)
  File "/usr/local/lib/python3.7/site-packages/flask/cli.py", line 526, in get_command
    rv = info.load_app().cli.get_command(ctx, name)
  File "/usr/local/lib/python3.7/site-packages/flask/cli.py", line 381, in load_app
    app = locate_app(self, import_name, name)
  File "/usr/local/lib/python3.7/site-packages/flask/cli.py", line 236, in locate_app
    __import__(module_name)
  File "/data/apps/cmdb/autoapp.py", line 9, in <module>
    app = create_app()
  File "/data/apps/cmdb/api/app.py", line 82, in create_app
    register_extensions(app)
  File "/data/apps/cmdb/api/app.py", line 103, in register_extensions
    es.init_app(app)
  File "/data/apps/cmdb/api/lib/utils.py", line 110, in init_app
    if not self.es.indices.exists(index=self.index):
  File "/usr/local/lib/python3.7/site-packages/elasticsearch/client/utils.py", line 84, in _wrapped
    return func(*args, params=params, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/elasticsearch/client/indices.py", line 273, in exists
    return self.transport.perform_request("HEAD", _make_path(index), params=params)
  File "/usr/local/lib/python3.7/site-packages/elasticsearch/transport.py", line 350, in perform_request
    timeout=timeout,
  File "/usr/local/lib/python3.7/site-packages/elasticsearch/connection/http_urllib3.py", line 245, in perform_request
    raise ConnectionError("N/A", str(e), e)
elasticsearch.exceptions.ConnectionError: ConnectionError(<urllib3.connection.HTTPConnection object at 0x7f5530ba2f10>: Failed to establish a new connection: [Errno 111] Connection refused) caused by: NewConnectionError(<urllib3.connection.HTTPConnection object at 0x7f5530ba2f10>: Failed to establish a new connection: [Errno 111] Connection refused)
<Celery __main__ at 0x7fdec1c64150>
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/urllib3/connection.py", line 157, in _new_conn
    (self._dns_host, self.port), self.timeout, **extra_kw
  File "/usr/local/lib/python3.7/site-packages/urllib3/util/connection.py", line 61, in create_connection
    for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM):
  File "/usr/local/lib/python3.7/socket.py", line 748, in getaddrinfo
    for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno -3] Try again

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/elasticsearch/connection/http_urllib3.py", line 233, in perform_request
    method, url, body, retries=Retry(False), headers=request_headers, **kw
  File "/usr/local/lib/python3.7/site-packages/urllib3/connectionpool.py", line 720, in urlopen
    method, url, error=e, _pool=self, _stacktrace=sys.exc_info()[2]
  File "/usr/local/lib/python3.7/site-packages/urllib3/util/retry.py", line 376, in increment
    raise six.reraise(type(error), error, _stacktrace)
  File "/usr/local/lib/python3.7/site-packages/urllib3/packages/six.py", line 735, in reraise
    raise value
  File "/usr/local/lib/python3.7/site-packages/urllib3/connectionpool.py", line 672, in urlopen
    chunked=chunked,
  File "/usr/local/lib/python3.7/site-packages/urllib3/connectionpool.py", line 387, in _make_request
    conn.request(method, url, **httplib_request_kw)
  File "/usr/local/lib/python3.7/http/client.py", line 1252, in request
    self._send_request(method, url, body, headers, encode_chunked)
  File "/usr/local/lib/python3.7/http/client.py", line 1298, in _send_request
    self.endheaders(body, encode_chunked=encode_chunked)
  File "/usr/local/lib/python3.7/http/client.py", line 1247, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
  File "/usr/local/lib/python3.7/http/client.py", line 1026, in _send_output
    self.send(msg)
  File "/usr/local/lib/python3.7/http/client.py", line 966, in send
    self.connect()
  File "/usr/local/lib/python3.7/site-packages/urllib3/connection.py", line 184, in connect
    conn = self._new_conn()
  File "/usr/local/lib/python3.7/site-packages/urllib3/connection.py", line 169, in _new_conn
    self, "Failed to establish a new connection: %s" % e
urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPConnection object at 0x7fdec13f71d0>: Failed to establish a new connection: [Errno -3] Try again

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/bin/celery", line 8, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.7/site-packages/celery/__main__.py", line 16, in main
    _main()
  File "/usr/local/lib/python3.7/site-packages/celery/bin/celery.py", line 322, in main
    cmd.execute_from_commandline(argv)
  File "/usr/local/lib/python3.7/site-packages/celery/bin/celery.py", line 496, in execute_from_commandline
    super(CeleryCommand, self).execute_from_commandline(argv)))
  File "/usr/local/lib/python3.7/site-packages/celery/bin/base.py", line 288, in execute_from_commandline
    argv = self.setup_app_from_commandline(argv)
  File "/usr/local/lib/python3.7/site-packages/celery/bin/base.py", line 502, in setup_app_from_commandline
    self.app = self.find_app(app)
  File "/usr/local/lib/python3.7/site-packages/celery/bin/base.py", line 524, in find_app
    return find_app(app, symbol_by_name=self.symbol_by_name)
  File "/usr/local/lib/python3.7/site-packages/celery/app/utils.py", line 368, in find_app
    sym = symbol_by_name(app, imp=imp)
  File "/usr/local/lib/python3.7/site-packages/celery/bin/base.py", line 527, in symbol_by_name
    return imports.symbol_by_name(name, imp=imp)
  File "/usr/local/lib/python3.7/site-packages/kombu/utils/imports.py", line 56, in symbol_by_name
    module = imp(module_name, package=package, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/celery/utils/imports.py", line 111, in import_from_cwd
    return imp(module, package=package)
  File "/usr/local/lib/python3.7/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
  File "<frozen importlib._bootstrap>", line 983, in _find_and_load
  File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 728, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/data/apps/cmdb/celery_worker.py", line 9, in <module>
    app = create_app()
  File "/data/apps/cmdb/api/app.py", line 82, in create_app
    register_extensions(app)
  File "/data/apps/cmdb/api/app.py", line 103, in register_extensions
    es.init_app(app)
  File "/data/apps/cmdb/api/lib/utils.py", line 110, in init_app
    if not self.es.indices.exists(index=self.index):
  File "/usr/local/lib/python3.7/site-packages/elasticsearch/client/utils.py", line 84, in _wrapped
    return func(*args, params=params, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/elasticsearch/client/indices.py", line 273, in exists
    return self.transport.perform_request("HEAD", _make_path(index), params=params)
  File "/usr/local/lib/python3.7/site-packages/elasticsearch/transport.py", line 350, in perform_request
    timeout=timeout,
  File "/usr/local/lib/python3.7/site-packages/elasticsearch/connection/http_urllib3.py", line 245, in perform_request
    raise ConnectionError("N/A", str(e), e)
elasticsearch.exceptions.ConnectionError: ConnectionError(<urllib3.connection.HTTPConnection object at 0x7fdec13f71d0>: Failed to establish a new connection: [Errno -3] Try again) caused by: NewConnectionError(<urllib3.connection.HTTPConnection object at 0x7fdec13f71d0>: Failed to establish a new connection: [Errno -3] Try again)

查询search 日志

OpenJDK 64-Bit Server VM warning: Option UseConcMarkSweepGC was deprecated in version 9.0 and will likely be removed in a future release.
{"type": "server", "timestamp": "2020-08-06T01:36:38,682Z", "level": "INFO", "component": "o.e.e.NodeEnvironment", "cluster.name": "docker-cluster", "node.name": "c7acb530251f", "message": "using [1] data paths, mounts [[/usr/share/elasticsearch/data (/dev/mapper/centos-root)]], net usable_space [16.5gb], net total_space [35.1gb], types [xfs]" }
{"type": "server", "timestamp": "2020-08-06T01:36:38,721Z", "level": "INFO", "component": "o.e.e.NodeEnvironment", "cluster.name": "docker-cluster", "node.name": "c7acb530251f", "message": "heap size [503.6mb], compressed ordinary object pointers [true]" }
{"type": "server", "timestamp": "2020-08-06T01:36:38,739Z", "level": "INFO", "component": "o.e.n.Node", "cluster.name": "docker-cluster", "node.name": "c7acb530251f", "message": "node name [c7acb530251f], node ID [ThJGCbqJQwW5IBQKwp9HiA], cluster name [docker-cluster]" }
{"type": "server", "timestamp": "2020-08-06T01:36:38,744Z", "level": "INFO", "component": "o.e.n.Node", "cluster.name": "docker-cluster", "node.name": "c7acb530251f", "message": "version[7.4.2], pid[1], build[default/docker/2f90bbf7b93631e52bafb59b3b049cb44ec25e96/2019-10-28T20:40:44.881551Z], OS[Linux/3.10.0-1127.13.1.el7.x86_64/amd64], JVM[AdoptOpenJDK/OpenJDK 64-Bit Server VM/13.0.1/13.0.1+9]" }
{"type": "server", "timestamp": "2020-08-06T01:36:38,745Z", "level": "INFO", "component": "o.e.n.Node", "cluster.name": "docker-cluster", "node.name": "c7acb530251f", "message": "JVM home [/usr/share/elasticsearch/jdk]" }
{"type": "server", "timestamp": "2020-08-06T01:36:38,746Z", "level": "INFO", "component": "o.e.n.Node", "cluster.name": "docker-cluster", "node.name": "c7acb530251f", "message": "JVM arguments [-Xms1g, -Xmx1g, -XX:+UseConcMarkSweepGC, -XX:CMSInitiatingOccupancyFraction=75, -XX:+UseCMSInitiatingOccupancyOnly, -Des.networkaddress.cache.ttl=60, -Des.networkaddress.cache.negative.ttl=10, -XX:+AlwaysPreTouch, -Xss1m, -Djava.awt.headless=true, -Dfile.encoding=UTF-8, -Djna.nosys=true, -XX:-OmitStackTraceInFastThrow, -Dio.netty.noUnsafe=true, -Dio.netty.noKeySetOptimization=true, -Dio.netty.recycler.maxCapacityPerThread=0, -Dio.netty.allocator.numDirectArenas=0, -Dlog4j.shutdownHookEnabled=false, -Dlog4j2.disable.jmx=true, -Djava.io.tmpdir=/tmp/elasticsearch-15608830830750211217, -XX:+HeapDumpOnOutOfMemoryError, -XX:HeapDumpPath=data, -XX:ErrorFile=logs/hs_err_pid%p.log, -Xlog:gc*,gc+age=trace,safepoint:file=logs/gc.log:utctime,pid,tags:filecount=32,filesize=64m, -Djava.locale.providers=COMPAT, -Des.cgroups.hierarchy.override=/, -Xms512m, -Xmx512m, -Dio.netty.allocator.type=unpooled, -XX:MaxDirectMemorySize=268435456, -Des.path.home=/usr/share/elasticsearch, -Des.path.conf=/usr/share/elasticsearch/config, -Des.distribution.flavor=default, -Des.distribution.type=docker, -Des.bundled_jdk=true]" }
{"type": "server", "timestamp": "2020-08-06T01:36:53,310Z", "level": "INFO", "component": "o.e.p.PluginsService", "cluster.name": "docker-cluster", "node.name": "c7acb530251f", "message": "loaded module [aggs-matrix-stats]" }
{"type": "server", "timestamp": "2020-08-06T01:36:53,311Z", "level": "INFO", "component": "o.e.p.PluginsService", "cluster.name": "docker-cluster", "node.name": "c7acb530251f", "message": "loaded module [analysis-common]" }
{"type": "server", "timestamp": "2020-08-06T01:36:53,311Z", "level": "INFO", "component": "o.e.p.PluginsService", "cluster.name": "docker-cluster", "node.name": "c7acb530251f", "message": "loaded module [data-frame]" }
{"type": "server", "timestamp": "2020-08-06T01:36:53,312Z", "level": "INFO", "component": "o.e.p.PluginsService", "cluster.name": "docker-cluster", "node.name": "c7acb530251f", "message": "loaded module [flattened]" }
{"type": "server", "timestamp": "2020-08-06T01:36:53,312Z", "level": "INFO", "component": "o.e.p.PluginsService", "cluster.name": "docker-cluster", "node.name": "c7acb530251f", "message": "loaded module [frozen-indices]" }
{"type": "server", "timestamp": "2020-08-06T01:36:53,312Z", "level": "INFO", "component": "o.e.p.PluginsService", "cluster.name": "docker-cluster", "node.name": "c7acb530251f", "message": "loaded module [ingest-common]" }
{"type": "server", "timestamp": "2020-08-06T01:36:53,312Z", "level": "INFO", "component": "o.e.p.PluginsService", "cluster.name": "docker-cluster", "node.name": "c7acb530251f", "message": "loaded module [ingest-geoip]" }
{"type": "server", "timestamp": "2020-08-06T01:36:53,313Z", "level": "INFO", "component": "o.e.p.PluginsService", "cluster.name": "docker-cluster", "node.name": "c7acb530251f", "message": "loaded module [ingest-user-agent]" }
{"type": "server", "timestamp": "2020-08-06T01:36:53,313Z", "level": "INFO", "component": "o.e.p.PluginsService", "cluster.name": "docker-cluster", "node.name": "c7acb530251f", "message": "loaded module [lang-expression]" }
{"type": "server", "timestamp": "2020-08-06T01:36:53,330Z", "level": "INFO", "component": "o.e.p.PluginsService", "cluster.name": "docker-cluster", "node.name": "c7acb530251f", "message": "loaded module [lang-mustache]" }
{"type": "server", "timestamp": "2020-08-06T01:36:53,330Z", "level": "INFO", "component": "o.e.p.PluginsService", "cluster.name": "docker-cluster", "node.name": "c7acb530251f", "message": "loaded module [lang-painless]" }
{"type": "server", "timestamp": "2020-08-06T01:36:53,330Z", "level": "INFO", "component": "o.e.p.PluginsService", "cluster.name": "docker-cluster", "node.name": "c7acb530251f", "message": "loaded module [mapper-extras]" }
{"type": "server", "timestamp": "2020-08-06T01:36:53,331Z", "level": "INFO", "component": "o.e.p.PluginsService", "cluster.name": "docker-cluster", "node.name": "c7acb530251f", "message": "loaded module [parent-join]" }
{"type": "server", "timestamp": "2020-08-06T01:36:53,331Z", "level": "INFO", "component": "o.e.p.PluginsService", "cluster.name": "docker-cluster", "node.name": "c7acb530251f", "message": "loaded module [percolator]" }
{"type": "server", "timestamp": "2020-08-06T01:36:53,331Z", "level": "INFO", "component": "o.e.p.PluginsService", "cluster.name": "docker-cluster", "node.name": "c7acb530251f", "message": "loaded module [rank-eval]" }
{"type": "server", "timestamp": "2020-08-06T01:36:53,331Z", "level": "INFO", "component": "o.e.p.PluginsService", "cluster.name": "docker-cluster", "node.name": "c7acb530251f", "message": "loaded module [reindex]" }
{"type": "server", "timestamp": "2020-08-06T01:36:53,332Z", "level": "INFO", "component": "o.e.p.PluginsService", "cluster.name": "docker-cluster", "node.name": "c7acb530251f", "message": "loaded module [repository-url]" }
{"type": "server", "timestamp": "2020-08-06T01:36:53,332Z", "level": "INFO", "component": "o.e.p.PluginsService", "cluster.name": "docker-cluster", "node.name": "c7acb530251f", "message": "loaded module [search-business-rules]" }
{"type": "server", "timestamp": "2020-08-06T01:36:53,332Z", "level": "INFO", "component": "o.e.p.PluginsService", "cluster.name": "docker-cluster", "node.name": "c7acb530251f", "message": "loaded module [spatial]" }
{"type": "server", "timestamp": "2020-08-06T01:36:53,332Z", "level": "INFO", "component": "o.e.p.PluginsService", "cluster.name": "docker-cluster", "node.name": "c7acb530251f", "message": "loaded module [transport-netty4]" }
{"type": "server", "timestamp": "2020-08-06T01:36:53,332Z", "level": "INFO", "component": "o.e.p.PluginsService", "cluster.name": "docker-cluster", "node.name": "c7acb530251f", "message": "loaded module [vectors]" }
{"type": "server", "timestamp": "2020-08-06T01:36:53,333Z", "level": "INFO", "component": "o.e.p.PluginsService", "cluster.name": "docker-cluster", "node.name": "c7acb530251f", "message": "loaded module [x-pack-analytics]" }
{"type": "server", "timestamp": "2020-08-06T01:36:53,333Z", "level": "INFO", "component": "o.e.p.PluginsService", "cluster.name": "docker-cluster", "node.name": "c7acb530251f", "message": "loaded module [x-pack-ccr]" }
{"type": "server", "timestamp": "2020-08-06T01:36:53,344Z", "level": "INFO", "component": "o.e.p.PluginsService", "cluster.name": "docker-cluster", "node.name": "c7acb530251f", "message": "loaded module [x-pack-core]" }
{"type": "server", "timestamp": "2020-08-06T01:36:53,345Z", "level": "INFO", "component": "o.e.p.PluginsService", "cluster.name": "docker-cluster", "node.name": "c7acb530251f", "message": "loaded module [x-pack-deprecation]" }
{"type": "server", "timestamp": "2020-08-06T01:36:53,345Z", "level": "INFO", "component": "o.e.p.PluginsService", "cluster.name": "docker-cluster", "node.name": "c7acb530251f", "message": "loaded module [x-pack-graph]" }
{"type": "server", "timestamp": "2020-08-06T01:36:53,345Z", "level": "INFO", "component": "o.e.p.PluginsService", "cluster.name": "docker-cluster", "node.name": "c7acb530251f", "message": "loaded module [x-pack-ilm]" }
{"type": "server", "timestamp": "2020-08-06T01:36:53,346Z", "level": "INFO", "component": "o.e.p.PluginsService", "cluster.name": "docker-cluster", "node.name": "c7acb530251f", "message": "loaded module [x-pack-logstash]" }
{"type": "server", "timestamp": "2020-08-06T01:36:53,346Z", "level": "INFO", "component": "o.e.p.PluginsService", "cluster.name": "docker-cluster", "node.name": "c7acb530251f", "message": "loaded module [x-pack-ml]" }
{"type": "server", "timestamp": "2020-08-06T01:36:53,346Z", "level": "INFO", "component": "o.e.p.PluginsService", "cluster.name": "docker-cluster", "node.name": "c7acb530251f", "message": "loaded module [x-pack-monitoring]" }
{"type": "server", "timestamp": "2020-08-06T01:36:53,346Z", "level": "INFO", "component": "o.e.p.PluginsService", "cluster.name": "docker-cluster", "node.name": "c7acb530251f", "message": "loaded module [x-pack-rollup]" }
{"type": "server", "timestamp": "2020-08-06T01:36:53,347Z", "level": "INFO", "component": "o.e.p.PluginsService", "cluster.name": "docker-cluster", "node.name": "c7acb530251f", "message": "loaded module [x-pack-security]" }
{"type": "server", "timestamp": "2020-08-06T01:36:53,347Z", "level": "INFO", "component": "o.e.p.PluginsService", "cluster.name": "docker-cluster", "node.name": "c7acb530251f", "message": "loaded module [x-pack-sql]" }
{"type": "server", "timestamp": "2020-08-06T01:36:53,347Z", "level": "INFO", "component": "o.e.p.PluginsService", "cluster.name": "docker-cluster", "node.name": "c7acb530251f", "message": "loaded module [x-pack-voting-only-node]" }
{"type": "server", "timestamp": "2020-08-06T01:36:53,347Z", "level": "INFO", "component": "o.e.p.PluginsService", "cluster.name": "docker-cluster", "node.name": "c7acb530251f", "message": "loaded module [x-pack-watcher]" }
{"type": "server", "timestamp": "2020-08-06T01:36:53,354Z", "level": "INFO", "component": "o.e.p.PluginsService", "cluster.name": "docker-cluster", "node.name": "c7acb530251f", "message": "loaded plugin [analysis-ik]" }
{"type": "server", "timestamp": "2020-08-06T01:37:17,165Z", "level": "INFO", "component": "o.e.x.s.a.s.FileRolesStore", "cluster.name": "docker-cluster", "node.name": "c7acb530251f", "message": "parsed [0] roles from file [/usr/share/elasticsearch/config/roles.yml]" }
{"type": "server", "timestamp": "2020-08-06T01:37:30,165Z", "level": "WARN", "component": "o.e.b.ElasticsearchUncaughtExceptionHandler", "cluster.name": "docker-cluster", "node.name": "c7acb530251f", "message": "uncaught exception in thread [main]", 
"stacktrace": ["org.elasticsearch.bootstrap.StartupException: ElasticsearchException[Failure running machine learning native code. This could be due to running on an unsupported OS or distribution, missing OS libraries, or a problem with the temp directory. To bypass this problem by running Elasticsearch without machine learning functionality set [xpack.ml.enabled: false].]",
"at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:163) ~[elasticsearch-7.4.2.jar:7.4.2]",
"at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:150) ~[elasticsearch-7.4.2.jar:7.4.2]",
"at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:86) ~[elasticsearch-7.4.2.jar:7.4.2]",
"at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:125) ~[elasticsearch-cli-7.4.2.jar:7.4.2]",
"at org.elasticsearch.cli.Command.main(Command.java:90) ~[elasticsearch-cli-7.4.2.jar:7.4.2]",
"at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:115) ~[elasticsearch-7.4.2.jar:7.4.2]",
"at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:92) ~[elasticsearch-7.4.2.jar:7.4.2]",
"Caused by: org.elasticsearch.ElasticsearchException: Failure running machine learning native code. This could be due to running on an unsupported OS or distribution, missing OS libraries, or a problem with the temp directory. To bypass this problem by running Elasticsearch without machine learning functionality set [xpack.ml.enabled: false].",
"at org.elasticsearch.xpack.ml.MachineLearning.createComponents(MachineLearning.java:524) ~[?:?]",
"at org.elasticsearch.node.Node.lambda$new$9(Node.java:450) ~[elasticsearch-7.4.2.jar:7.4.2]",
"at java.util.stream.ReferencePipeline$7$1.accept(ReferencePipeline.java:271) ~[?:?]",
"at java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1621) ~[?:?]",
"at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484) ~[?:?]",
"at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474) ~[?:?]",
"at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:913) ~[?:?]",
"at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) ~[?:?]",
"at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:578) ~[?:?]",
"at org.elasticsearch.node.Node.<init>(Node.java:453) ~[elasticsearch-7.4.2.jar:7.4.2]",
"at org.elasticsearch.node.Node.<init>(Node.java:255) ~[elasticsearch-7.4.2.jar:7.4.2]",
"at org.elasticsearch.bootstrap.Bootstrap$5.<init>(Bootstrap.java:221) ~[elasticsearch-7.4.2.jar:7.4.2]",
"at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:221) ~[elasticsearch-7.4.2.jar:7.4.2]",
"at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:349) ~[elasticsearch-7.4.2.jar:7.4.2]",
"at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:159) ~[elasticsearch-7.4.2.jar:7.4.2]",
"... 6 more"] }

查询错误原因 https://stackoverflow.com/questions/58145464/elasticsearchexception-failure-running-machine-learning-native-code 由于系统原因需要修改配置文件,但无法使用 docker -it exe 进入该容器;不太清楚您开发使用什么版本系统,测试使用什么版本系统,是不是系统兼容性的问题,请帮助解决,谢谢! PS docker 版本 Docker version 19.03.12, build 48a66213fe, docker-compose版本

docker-compose version 1.18.0, build 8dd22a9
docker-py version: 2.6.1
CPython version: 3.6.8
OpenSSL version: OpenSSL 1.0.2k-fips  26 Jan 2017

`

charnet1019 commented 4 years ago

我将我最终成功部署的经历分享如下,希望对后来者有用:

这几天使用windows、centos、debian多种操作系统各种方式尝试部署,部署完成后测试登录时总是报错request error。同事用debian虚拟机尝试部署成功,但那个虚拟机有些与此项目无直接关系的恶性Bug。之后,我改用docker部署,还是报错。目前,我查看#40 fix的历史代码和该issue的讨论记录,将docker-compose.yml里的sleep的值由5改成100后再重用docker部署,使用浏览器chrome 77.0.3865.90(windows系统自带的IE 11.592.18362.0不能正常访问登录页面:账户密码输入框不可见)登录成功并能正常工作。

解决了登录失败的问题,的确是sleep值引起的,值过小导致es还没有完全启动