Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deploy: add docker-compose cluster deployment file #2740

Merged
merged 1 commit into from
Nov 5, 2020

Conversation

huikang
Copy link
Contributor

@huikang huikang commented Oct 8, 2020

  • To help beginners learning how to launch a cluster of
    loki on a local machine

Signed-off-by: Hui Kang [email protected]

What this PR does / why we need it:

Add a local deployment of loki cluster to ease the experiment of loki cluster.

Which issue(s) this PR fixes:
Fixes #2103

Special notes for your reviewer:
@periklis

Checklist

  • Documentation added


http_prefix:

server:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd like suggest better ingester config:

ingester:
    chunk_block_size: 262144
    chunk_encoding: snappy
    chunk_idle_period: 2h
    chunk_retain_period: 6m
    chunk_target_size: 1.572864e+06

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just realized you have 2 configs but you could have only one and use -target=all or -target=query-frontend

align_queries_with_step: true
max_retries: 5
# parallelize queries in 15min intervals
split_queries_by_interval: 15m
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel like we could also // by shard using parallelise_shardable_queries: true

Copy link
Contributor

@cyriltovena cyriltovena left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have no idea how you learned all of this but wow ⭐ this is awesome work.

My only suggestion here is related to config. I think we can make this even more simple using a single config.

I'm super excited about this cause this is a great example of how to run Loki and without Kubernetes.

@huikang
Copy link
Contributor Author

huikang commented Oct 16, 2020

Hi, @cyriltovena thanks for your encouraging words (at the beginning of the work I was not sure how it will be acceptable to deploy loki without k8s). I'll update the comment to address your comments.

Copy link
Collaborator

@periklis periklis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome work @huikang 🚀 🎉

@cyriltovena Let me introduce you to @huikang are newest member in OpenShift Logging Explore from IBM. He is the member I mentioned during the last bug scrub willing to imrove our loki-benchmarks and in turn local loki deployments w/o k8s.

@huikang


server {
listen 80;
proxy_set_header X-Scope-OrgID 1;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit. I suggest to use a meaningful name as OrgID. These IDs are also represented on the block storage layer as folder names as they represent the tenants.


}

server {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the purpose for this extra server here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is for load-balancing the requests from query-front end to the queriers. To avoid conflict with line 53, the nginx for the queriers listens on a different port, which is this server.

- Together they form a cluster ring based on memberlist mechanism (if using consul/etcd, modules can be separate for further separate read/write workloads)
- Index data are stored and replicated through botldb-shipper
- Replication_factor=2: the receiving distributor sends log data to 2 ingesters based on consistent hashing
- Chunk storage is a shared directory mounted from the same host directory (to simulate S3 or gcs)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cyriltovena Do we safely support this kind of operations on a local filesystem?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think so.

Comment on lines 29 to 30
chunk_idle_period: 30m
max_chunk_age: 2h
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for consistency with what we just made the other defaults a few days ago, can you set both of these to 1h?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

@slim-bean
Copy link
Collaborator

This is really neat @huikang I added a few comments for the loki config based on changes we just made earlier this week, this would put this config inline with those changes!

- To help beginners learning how to launch a cluster of
  loki on a local machine
- Use single loki config for both front-end and other nodes
- Fix query lookback and add /ring to gateway

Signed-off-by: Hui Kang <[email protected]>
@huikang
Copy link
Contributor Author

huikang commented Oct 28, 2020

This is really neat @huikang I added a few comments for the loki config based on changes we just made earlier this week, this would put this config inline with those changes!

@slim-bean Thanks for your comments. The PR is updated based on your suggestions.

Copy link
Contributor

@cyriltovena cyriltovena left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, if you have time to follow up with a grafana 7.3 PR would be great.

@cyriltovena cyriltovena merged commit d38377a into grafana:master Nov 5, 2020
@lux4rd0
Copy link

lux4rd0 commented Nov 20, 2020

Loving this additional information to build a local clustered Loki. In order to get around some of the errors on startup:

Some services (loki-frontend) use the 'deploy' key, which will be ignored. Compose does not support 'deploy' configuration - use docker stack deploy to deploy to a swarm.

I needed to use:

docker-compose -f ./docker-compose-ha-memberlist.yaml --compatibility up

Also - after startup, I'm not able to get to port 80/3100 externally to the loki docker network. Running on CentOS 7-8.2003.0.el7.centos.x86_64 with Docker version 19.03.13, docker-compose version 1.26.2

I am seeing the logs getting collected by Promtail and can browse those through the Grafana instance. Will continue to diagnose my access issue.

Also - any thoughts on why some of the Loki versions in the docker-compose are specific to 1.6 instead of :latest?

Thanks again!! Love it!!

@periklis
Copy link
Collaborator

Also - any thoughts on why some of the Loki versions in the docker-compose are specific to 1.6 instead of :latest?

Thanks again!! Love it!!

I believe this version mismatch is a hindsight, because the PR was developed close to 2.x release. Would you mind to open a PR to fix this?

@verticelo
Copy link

To insert events out of order would be great and much wanted since we can't use Loki in our organization until that is resolved.

#1544

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Documentation about local installation
6 participants