我有一个问题,当启动节点永远在docker容器中,如果我手动启动工作,而不是相同的命令在Dockerfile中,当构建并启动容器时,退出.该命令在bash中有效:
docker run -it container_name bash forever start -c 'node --harmony' /my/path/app.js
Run Code Online (Sandbox Code Playgroud)
我试图将命令放在Dockerfile中,但容器没有启动
CMD forever start -c 'node --harmony' /my/path/app.js
Run Code Online (Sandbox Code Playgroud) 我需要将www.foo.com和foo.com重定向到haproxy的www.bar.com,这是我的配置:
frontend http-in
bind *:80
acl bar.com hdr(host) -i www.bar.com
...
use_backend bar.com_cluster if bar.com
...
redirect prefix http://foo.com code 301 if { hdr(host) -i www.bar.com }
redirect prefix http://www.foo.com code 301 if { hdr(host) -i www.bar.com }
...
backend bar.com_cluster
balance roundrobin
option httpclose
option forwardfor
server bar 10.0.0.1:80 check
Run Code Online (Sandbox Code Playgroud)
我试过redirect prefix但不工作,有什么想法吗?
我已经安装了Elasticsearch 2.2.3并在2个节点的集群中进行了配置
节点1(elasticsearch.yml)
cluster.name: my-cluster
node.name: node1
bootstrap.mlockall: true
discovery.zen.ping.unicast.hosts: ["ec2-xx-xx-xx-xx.eu-west-1.compute.amazonaws.com", "ec2-xx-xx-xx-xx.eu-west-1.compute.amazonaws.com"]
discovery.zen.minimum_master_nodes: 1
discovery.zen.ping.multicast.enabled: false
indices.fielddata.cache.size: "30%"
indices.cache.filter.size: "30%"
node.master: true
node.data: true
http.cors.enabled: true
script.inline: false
script.indexed: false
network.bind_host: 0.0.0.0
Run Code Online (Sandbox Code Playgroud)
节点2(elasticsearch.yml)
cluster.name: my-cluster
node.name: node2
bootstrap.mlockall: true
discovery.zen.ping.unicast.hosts: ["ec2-xx-xx-xx-xx.eu-west-1.compute.amazonaws.com", "ec2-xx-xx-xx-xx.eu-west-1.compute.amazonaws.com"]
discovery.zen.minimum_master_nodes: 1
discovery.zen.ping.multicast.enabled: false
indices.fielddata.cache.size: "30%"
indices.cache.filter.size: "30%"
node.master: false
node.data: true
http.cors.enabled: true
script.inline: false
script.indexed: false
network.bind_host: 0.0.0.0
Run Code Online (Sandbox Code Playgroud)
如果我明白了curl -XGET 'http://localhost:9200/_cluster/state?pretty':
{
"error" : {
"root_cause" : [ {
"type" : "master_not_discovered_exception",
"reason" : …Run Code Online (Sandbox Code Playgroud) 我需要在脚本中运行命令到 docker 容器,我尝试使用:
docker run -it <container> /bin/bash -c "command"
Run Code Online (Sandbox Code Playgroud)
我没有错误,但命令没有执行
我使用 logstash-forwarder 和 logstash 并使用以下配置创建带有标签的动态索引:
/etc/logstash/conf.d/10-output.conf
output {
elasticsearch {
hosts => "localhost:9200"
manage_template => false
index => "logstash-%{tags}-%{+YYYY.MM.dd}"
}
}
Run Code Online (Sandbox Code Playgroud)
/etc/logstash-forwarder.conf
"files": [
{
"paths": [
"/var/log/httpd/ssl_access_log",
"/var/log/httpd/ssl_error_log"
],
"fields": { "type": "apache", "tags": "mytag" }
},
Run Code Online (Sandbox Code Playgroud)
相关的 filebeat 配置是:
/etc/filebeat/filebeat.yml
filebeat:
prospectors:
-
paths:
- /var/log/httpd/access_log
input_type: log
document_type: apache
fields:
tags: mytag
Run Code Online (Sandbox Code Playgroud)
在 Kibana 中,mytag我看到的不是我beats_input_codec_plain_applied所有的索引。
我的集群处于红色状态,堆大小几乎已满...我需要删除一些索引,但出现超时错误
{"error":{"root_cause":[{"type":"process_cluster_event_timeout_exception","reason":"failed to process cluster event (delete-index [my.index-2016.08.01]) within 30s"}],"type":"process_cluster_event_timeout_exception","reason":"failed to process cluster event (delete-index [my.index-2016.08.01]) within 30s"},"status":503}
Run Code Online (Sandbox Code Playgroud)
我可以删除红色状态的索引吗?
我需要/en从所有 URL 中删除前缀,例如。
www.mydomain.com/en/foo/bar/index.html -> www.mydomain.com/foo/bar/index.html
Run Code Online (Sandbox Code Playgroud)
我尝试过:
RewriteRule ^/en/(.*) /$1 [L]
Run Code Online (Sandbox Code Playgroud)
或者
RewriteRule ^/en/\d+-(.+) /$1 [R,L]
Run Code Online (Sandbox Code Playgroud)
但什么也没发生
嗨有SSL和haproxy的问题,我已将.crt与私钥连接但如果我检查SSL状态,我的网站不受信任,我需要安装捆绑证书,我试过这样:
bind *:443 ssl crt /etc/ssl/mydomain.com.pem ca-file /etc/ssl/mydomain.com-ca.bundle
Run Code Online (Sandbox Code Playgroud)
但是不要工作.HA代理版本1.5.2
我需要代理http://www.example.com/foo到http://<backend>/bar,使用 nginx 我有这样的配置:
server {
listen 80;
client_max_body_size 2048M;
server_name www.example.com;
location /foo {
proxy_pass http://container_name/bar/;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $remote_addr;
}
}
Run Code Online (Sandbox Code Playgroud)
我会将其转换为 traefik。这是我的撰写文件:
version: '3'
services:
traefik:
image: traefik:1.7.3-alpine
command: --api --docker
ports:
- "80:80"
- "8080:8080"
volumes:
- /var/run/docker.sock:/var/run/docker.sock
labels:
- traefik.enable=false
webapp:
...
...
labels:
- traefik.backend=bar
- traefik.frontend.rule=Host:www.example.com;Path:/foo/
- traefik.port=80
Run Code Online (Sandbox Code Playgroud)
有办法解决吗?
谢谢
我不明白数据量和数据容器之间有什么区别......例如,这两个 docker-compose 配置具有相同的结果,但第一个使用数据容器
白色数据容器
datacontainer:
image: httpd:2.4-alpine
volumes:
- ../src:/usr/local/apache2/htdocs
apache:
image: httpd:2.4-alpine
ports:
- 80:80
volumes_from:
- datacontainer
Run Code Online (Sandbox Code Playgroud)
没有数据容器
apache:
image: httpd:2.4-alpine
ports:
- 80:80
volumes:
- ../src:/usr/local/apache2/htdocs
Run Code Online (Sandbox Code Playgroud)
使用数据容器的优缺点是什么?
我需要找到一些容器docker的ID,但是一些容器有类似的名字:
$ docker images
REPOSITORY TAG IMAGE ID
app-node latest 620350b79c5a
app-node-temp latest 461c5143a985
Run Code Online (Sandbox Code Playgroud)
如果我跑:
$ docker images | grep -w app-node-temp | awk -e '{print $3}'
461c5143a985
Run Code Online (Sandbox Code Playgroud)
如果我改为:
$ docker images | grep -w app-node | awk -e '{print $3}'
620350b79c5a
461c5143a985
Run Code Online (Sandbox Code Playgroud)
我怎样才能匹配确切的名字?