Jaeger Quick Experience
Official website download address https://www.jaegertracing.io/download/
GitHub download address https://github.com/jaegertracing/jaeger/releases
After downloading the compressed binary file, run the decompressed all-in-one file.
jaeger-all-in-one uses memory to store data and is designed for fast local testing.
example-hotrod is a sample application, run the access, and query data on the Jaeger UI.
Jaeger components
agent
jaeger-agent is the collector binary that is deployed on each server along with the jaeger-integrated application.
collector
jaeger-collector is a program file that interfaces with the agent, and stores the data collected by the agent in Cassandra or Elasticsearch. Multiple instances can be run in a load-balanced manner.
query
jaeger-query is a web-ui layer that displays and queries data in Cassandra or Elasticsearch. Multiple instances can be run in a load-balanced manner.
inster
jaeger-ingester is a service program that consumes data from Kafka and stores it in Cassandra or Elasticsearch.
deploy
Cassandra
Install
Configuration file: cassandra.yaml
docker mirror address
single vision
docker run --name jaeger-cassandra -d -p 7000:7000 -p 7001:7001 -p 7199:7199 -p 9042:9042 -p 9160:9160 cassandra:latest
cluster version
Please refer to the documentation
Whether you use containers or not, stand-alone or cluster, please read the configuration files and official documents and will not describe them here.
create keyspace
CREATE KEYSPACE qschou
WITH replication = {'class': 'SimpleStrategy', 'replication_factor' : 3};
Create data table
Table structure address: https://github.com/jaegertracing/jaeger/tree/master/plugin/storage/cassandra/schema
Select v001.cql.tmpl or v002.cql.tmpl,
Note that there are 4 variables in it, which can also be executed in cqlsh after replacement.
{replication} = see keyspaces section
default_time_to_live = default time to live() for table (in seconds) {dependencies_ttl}
The above parameters can be queried through https://cassandra.apache.org/doc/latest/cql/ddl.html#create-table.
Elasticsearch
Install
docker mirror address
single vision
docker run -d --name jaeger-es -p 9200:9200 -p 9300:9300 -e “discovery.type=single-node” elasticsearch:latest
create index
curl -X PUT \
http://localhost:9200/qschou \
-H ‘Content-Type: application/json’ \
-d '{
"settings" : {
"index" : {
"number_of_shards" : 3,
"number_of_replicas" : 2
}
}
}’
query index
curl -X GET ‘http://localhost:9200/_cat/indices?v=&=’
Deploy Jaeger components
Using cassandra storage
jaeger-collector
SPAN_STORAGE_TYPE=cassandra ./jaeger-collector --cassandra.keyspace=qschou --cassandra.servers=127.0.0.1 --cassandra.port=9042
jaeger-query
SPAN_STORAGE_TYPE=cassandra ./jaeger-query --cassandra.keyspace=qschou --cassandra.servers=127.0.0.1 --cassandra.port=9042
jaeger-agent
./jaeger-agent --collector.host-port=127.0.0.1:14267
Using elasticsearch storage
jaeger-collector
SPAN_STORAGE_TYPE=elasticsearch ./jaeger-collector --es.server-urls=http://127.0.0.1:9200 --es.index-prefix=qschou
jaeger-query
SPAN_STORAGE_TYPE=elasticsearch ./jaeger-query --es.server-urls=http://127.0.0.1:9200 --es.index-prefix=qschou
jaeger-agent
./jaeger-agent --collector.host-port=127.0.0.1:14267
Web UI address: http://localhost:16686
Store link information through Alibaba Cloud sls
sls is a commonly used log service of our company, which can be integrated through Jaeger on Aliyun Log service.
sls endpoint https://help.aliyun.com/document_detail/29008.html
collector
It is recommended to deploy multiple instances
In the intranet environment, please use the intranet endpoint
SPAN_STORAGE_TYPE=aliyun-log ./collector-darwin --cc.endpoint=cn-hangzhou.log.aliyuncs.com --aliyun-log.access-key-id=LT** --aliyun-log.access-key-secret=ho** --aliyun-log.project=dbj-mp --aliyun-log.span-logstore=coupon-api
agent
SPAN_STORAGE_TYPE=aliyun-log ./agent-darwin --collector.host-port=127.0.0.1:14267
query
It is recommended to deploy multiple instances
Use docker here
docker run -d --name jaeger-query -p 16686:16686 -e SPAN_STORAGE_TYPE=aliyun-log registry.cn-hangzhou.aliyuncs.com/jaegertracing/jaeger-query:0.1.9 /go/bin/query-linux --aliyun-log.endpoint=cn-hangzhou.log.aliyuncs.com --aliyun-log.access-key-id=LT** --aliyun-log.access-key-secret=ho** --aliyun-log.project=dbj-mp --aliyun-log.span-logstore=coupon-api --query.static-files=/go/jaeger-ui/
Introduction to Cassandra
Cassandra is a distributed NoSQL database developed by Facebook using Java and open sourced in 2008, and incubated and hosted by Apache in 2009.
Use the SQL-like CQL language to realize the definition, reading and writing of data models.
And similar to the Dynamo system architecture, it is a complete P2P architecture based on consistent hashing. Each row of data is hashed to determine which node or nodes should exist. The cluster does not have the concept of a master, and all nodes have the same role, which avoids single-point problems and improves stability.
The BigTable data model designed by Google is used. Unlike traditional row-oriented relational databases or key-value databases for key-value storage, Cassandra uses a wide column storage model (Wide Column Stores). Each row of data After being uniquely identified by the row key, there can be up to 2 billion columns, each column is identified by a column key, and each column key corresponds to several values. This model can be understood as a two-dimensional key-value storage, that is, the entire data model is defined as a type similar to map>.
cqlsh
cqlsh is a command-line shell for interacting with Cassandra via CQL. It ships with every Cassandra package and can be found in the bin directory next to the cassandra executable. It connects to a single node specified on the command line.
keyspaces
Key space: Similar to the database in MySQL.
View all keyspaces
DESCRIBE KEYSPACES;
Documentation: https://cassandra.apache.org/doc/latest/tools/cqlsh.html#describe
create keyspace
– test
CREATE KEYSPACE qschou
WITH replication = {'class': 'SimpleStrategy', 'replication_factor' : 3};
– prod
CREATE KEYSPACE qschou
WITH replication = {'class': 'NetworkTopologyStrategy', 'DC1' : 1, 'DC2' : 3}
AND durable_writes = false;
Documentation: https://cassandra.apache.org/doc/latest/cql/ddl.html#create-keyspace
select keyspace
USE keyspace_name
create table
CREATE TABLE timeline (
userid uuid,
posted_month int,
posted_time uuid,
body text,
posted_by text,
PRIMARY KEY (userid, posted_month, posted_time)
) WITH compaction = { ‘class’ : ‘LeveledCompactionStrategy’ };
Documentation: https://cassandra.apache.org/doc/latest/cql/ddl.html#create-table
Display all tables under keyspace
DESCRIBE qschou;
Introduction to Elasticsearch
Elasticsearch is a highly scalable Lucene-based open source full-text search and analysis engine. It allows you to store, search and analyze large amounts of data quickly and in near real time. It is often used as the underlying engine/technology to provide RESTful interface support for applications with complex search capabilities and requirements.
Near real-time means there is a slight delay (typically one second) from when a document is indexed to when it becomes searchable.
Index
Index: is a collection of documents with some similar characteristics, the index is identified by the name must be all lowercase.
*****jaeger error handling (HTTP Error: Search service failed: elastic: Error 400 (Bad Request))
Answer: You can check whether the versions of jaeger and Elasticsearch are compatible, and the personal test is successful (Jaeger1.11+elasticsearch5.6.16 can be deployed and built on a single machine)