github.com/m3db/m3@v1.5.0/src/query/README.md (about) 1 ## WARNING: This is Alpha software and not intended for use until a stable release. 2 3 # M3Coordinator 4 5 M3Coordinator is a service which provides APIs for reading/writing to [M3DB](https://github.com/m3db/m3) at a global and placement specific level. 6 It also acts as a bridge between [Prometheus](https://github.com/prometheus/prometheus) and [M3DB](https://github.com/m3db/m3). Using this bridge, [M3DB](https://github.com/m3db/m3) acts as a long term storage for [Prometheus](https://github.com/prometheus/prometheus) using the [remote read/write endpoints](https://github.com/prometheus/prometheus/blob/master/prompb/remote.proto). 7 A detailed explanation of setting up long term storage for Prometheus can be found [here](http://schd.ws/hosted_files/cloudnativeeu2017/73/Integrating%20Long-Term%20Storage%20with%20Prometheus%20-%20CloudNativeCon%20Berlin%2C%20March%2030%2C%202017.pdf). 8 9 ### Running in Docker 10 11 > Note that all commands are run within the root of the m3coordinator directory except where specified. 12 13 **Running both m3coordinator and Prometheus in containers:** 14 15 You can launch a Prometheus and m3coordinator container using `docker-compose`. However, you must first build the m3coordinator Docker image. 16 17 To do so, you will need the m3coordinator binary: 18 19 $ GOOS=linux GOARCH=amd64 CGO_ENABLED=0 make services 20 21 Once you have the binary, you can run the following in the root of the project to make the Docker image: 22 23 $ docker build -t m3coordinator -f docker/m3coordinator/Dockerfile . 24 25 Finally, you can spin up the two containers using `docker-compose` within the `docker/` directory: 26 27 $ docker-compose up 28 29 *Note:* The default local ports for Prometheus and m3coordinator are `9090` and `7201`, respectively, and the default `prometheus.yml` file is `docker/prometheus.yml` 30 31 If you want to override these, you can pass in the following environment variables to the `docker-compose` command: 32 33 - `LOCAL_PROM_PORT` 34 - `LOCAL_M3COORD_PORT` 35 - `LOCAL_PROM_YML` 36 37 (e.g. `$ LOCAL_PROM_PORT=XXXX LOCAL_M3COORD_PORT=XXXX LOCAL_PROM_YML=/path/to/yml docker-compose up`) 38 39 **Running m3coordinator locally (on mac only) and Prometheus in Docker container (for development):** 40 41 Build m3coordinator binary: 42 43 $ make services 44 45 Run m3coordinator binary: 46 47 $ ./bin/m3coordinator -f src/query/config/m3query-dev-etcd.yml 48 49 Run Prometheus Docker image: 50 51 $ docker run -p 9090:9090 -v $GOPATH/src/github.com/m3db/m3/src/query/docker/prometheus-mac.yml:/etc/prometheus/prometheus.yml quay.io/prometheus/prometheus 52 53 ### Running on GCP 54 55 Setup GCP for [single m3db node](https://github.com/m3db/m3/pull/452/files?short_path=20bfc3f#diff-20bfc3ff6a860483887b93bf9cf0d135) 56 57 > For a multi-node cluster, [see here](https://github.com/m3db/m3/src/query/tree/master/benchmark) 58 59 Setup GCP for m3coordinator: 60 61 1. Make sure you select a base image with Docker pre-installed 62 2. Follow steps 1-5 from the above section (clone `m3coordinator` instead of `m3db`) 63 3. The config file, which is located at `m3coordinator/benchmark/configs/benchmark.yml` will need the same config topology as the m3db config 64 4. Run m3coordinator - you should see this message with the number of hosts you specified: `[I] successfully updated topology to 3 hosts` with no other warning or error messsages 65 $ ./bin/m3coordinator --config.file benchmark/configs/benchmark.yml 66 67 Setup and run Prometheus: 68 69 1. You can run Prometheus from the same box as m3coordinator 70 2. Update the `prometheus.yml` in `m3coordinator/docker` so that the `remote_read` and `remote_write` endpoints are bound to the IP address of the host that m3coordinator is running on: 71 - e.g. 72 ``` 73 remote_read: 74 - url: http://10.142.0.8:7201/api/v1/prom/remote/read 75 76 remote_write: 77 - url: http://10.142.0.8:7201/api/v1/prom/remote/write 78 ``` 79 3. Run Prometheus 80 $ sudo docker run -p 9090:9090 -v $GOPATH/src/github.com/m3db/m3/src/query/docker/prometheus.yml:/etc/prometheus/prometheus.yml quay.io/prometheus/prometheus