Public Repository

Last pushed: 5 months ago
Short Description
docker-compose使用注意事项
Full Description

使用ilog容器的注意事项:
1.运行docker-compose命令前要先执行脚本step1.sh,作用是创建/opt/es/data路径并开放目录的权限,这样可以让非root用户es将数据写入。
2.docker-compose命令成功运行后执行createTopic.sh脚本,作用是进入生成的kafka容器内部创建kafka的topic,注意需要检查脚本中的data_kafka_1是否为kafka生成的容器,如果容器名被修改,则需修改脚本中kafka容器名。
3.docker-compose命令成功运行后执行createIndex.sh脚本,作用是生成elasticsearch中存储数据的Index。

ilog的docker-compose.yml内容为:
version: '2'
services:
elasticsearch:
build: gispark/ilog-elasticsearch
ports:

  - "9200:9200"
  - "9300:9300"
environment:
  ES_JAVA_OPTS: "-Xms1g -Xmx1g"
volumes:
  - /opt/es/data:/usr/share/elasticsearch/data

- /opt/es/logs:/usr/share/elasticsearch/logs

networks:
  - docker_elk

kibana:
build: gispark/ilog-kibana
ports:

  - "5601:5601"
networks:
  - docker_elk
depends_on:
  - elasticsearch
links:
  - elasticsearch

logstash:
build: gispark/ilog-logstash
ports:

  - "5000:5000"
networks:
  - docker_elk
depends_on:
  - elasticsearch
  - zookeeper
  - kafka
links: 
  - elasticsearch
  - zookeeper

zookeeper:
build: gispark/ilog-zookeeper
ports:

  - "2181:2181"
networks:
  - docker_elk
volumes:
  - /opt/zookeeper:/opt/zookeeper

kafka:
build: gispark/ilog-kafka
ports:

  - "9092:9092"
networks:
  - docker_elk
volumes:
  - /opt/kafka/kafka-logs:/opt/kafka/kafka-logs
depends_on: 
  - zookeeper    
links:
  - zookeeper    

flume:
build: gispark/ilog-flume
ports:

  - "44444:44444"
networks: 
  - docker_elk
depends_on:
  - kafka
links:
  - kafka

networks:
docker_elk:
driver: bridge

附上3个执行脚本:
step1.sh

#!/bin/bash
esDataPath="/opt/es/data"
if [ ! -d "$esDataPath" ];then
mkdir -p $esDataPath
fi
chmod -R 777 $esDataPath

createTopic.sh

#!/bin/bash
docker exec -it data_kafka_1 bin/kafka-topics.sh --zookeeper zookeeper:2181 --topic supermap1 --replication-factor 1 --partitions 5 --create

createIndex.sh

#/bin/bash
curl -XPUT localhost:9200/test1 -d '
{
"settings": {
"number_of_shards": 5,
"number_of_replicas": 1
},
"mappings" : {
"log4" : {
"properties" : {
"@timestamp" : {
"type" : "date",
"format" : "strict_date_optional_time||epoch_millis"
},
"@version" : {
"type" : "string"
},
"IP" : {
"type" : "string",
"index": "not_analyzed"
},
"MACAddress" : {
"type" : "string",
"index": "not_analyzed"
},
"ProductID" : {
"type" : "string",
"index": "not_analyzed"
},
"ProductInfo" : {
"properties" : {
"DesktopVersion" : {
"type" : "long",
"index": "not_analyzed"
},
"FunctionInfo" : {
"properties" : {
"Caption" : {
"type" : "string",
"index": "not_analyzed"
},
"CtrlActionName" : {
"type" : "string",
"index": "not_analyzed"
},
"ExecuteDateTime" : {
"type" : "date"
},
"ExecuteTime" : {
"type" : "string"

              },
              "FunctionGrade1" : {
                "type" : "string",

"index": "not_analyzed"
},
"FunctionGrade2" : {
"type" : "string",
"index": "not_analyzed"
},
"FunctionGrade3" : {
"type" : "string",
"index": "not_analyzed"
},
"GDIIncrement" : {
"type" : "long"
},
"GDITotal" : {
"type" : "long"
},
"IsException" : {
"type" : "boolean"
},
"IsFinished" : {
"type" : "string"
},
"MemoryIncrement" : {
"type" : "double"
},
"MemoryTotal" : {
"type" : "double"
},
"Message" : {
"type" : "string"
},
"ProcessCount" : {
"type" : "long"
},
"StackTrace" : {
"type" : "string",
"index": "not_analyzed"
},
"TotalTime" : {
"type" : "double"
},
"UserObjectIncerment" : {
"type" : "long"
},
"UserObjectTotal" : {
"type" : "long"
}
}
},
"LicenseInfo" : {
"properties" : {
"LicenseInfos" : {
"properties" : {
"LicenseMode" : {
"type" : "string",
"index": "not_analyzed"
},
"LicenseName" : {
"type" : "string",
"index": "not_analyzed"
}
}
}
}
},
"OptionSystem" : {
"type" : "string",
"index": "not_analyzed"
},
"PlatForm" : {
"type" : "string",
"index": "not_analyzed"
},
"ProductName" : {
"type" : "string",
"index": "not_analyzed"
},
"ResolutionRatio" : {
"type" : "string",
"index": "not_analyzed"
},
"UserID" : {
"type" : "string"
},
"UserName" : {
"type" : "string",
"index": "not_analyzed"
},
"Version" : {
"type" : "string",
"index": "not_analyzed"
}
}
},
"ThreadID" : {
"type" : "string"
},
"geoip" : {
"properties" : {
"city_name" : {
"type" : "string"
},
"location" : {
"type" : "geo_point"
}
}
},
"type" : {
"type" : "string"
}
}
}
}
}
'

Docker Pull Command
Owner
gispark

Comments (0)