© 2022 - aleteo.co
In the actual production, in the face of dozens or even hundreds of microservice instances, if an instance goes down, if it can't locate and submit early warning quickly, the loss to the actual production is undoubtedly huge. Therefore, it is necessary to monitor and forewarn the microservice, monitor the call link of the microservice, and quickly locate the problem
From the openhabian-config output it is obvious that the InfluxDB daemon fails to start. The most common reasons are port already in use (as @jswim788 already mentioned), and access rights. Since the setup is done with openHABian, the 2nd option is unlikely. The first option can easily be checked with. Now that we have a database, InfluxDB is ready to accept queries and writes. First, a short primer on the datastore. Data in InfluxDB is organized by “time series”, which contain a measured value, like “cpuload” or “temperature”. Time series have zero to many points, one for each discrete sample of the metric.
visit localhost:9200 Is there any similar data returned as follows
If it doesn't return, go to the storage location of the log and check the error content in the log. If you don't know the storage location of the log, you can view it elasticsearch.yml In path.log The value of the parameter corresponds to the storage location of the log
stay SkyWalking official website Download the corresponding version. Here you download the Binary Distribution for ElasticSearch 7 version, because the Elasticsearch version installed above is 7
Unzip and modify the configuration
2.1 decompress the compressed package
2.2 enter the unzipped folder and modify / config/application.yml to configure
Configuration Description:
cluster: there are several registration centers to choose from. The default is standalone
core: default configuration
Storage: it is used to store trace data for query and display. It provides H2, Mysql, ES, and InfluxDB storage methods. recordDataTTL is how long data is stored. The default is 7 days
Here, select es7 to comment out other storage methods. Then select elastic search 7 in the selector option of the storage
Launch OAP and SkyWalkingUI
After startup, as shown in the figure
Remember to turn on the Auto button and configure the start filtering time below. Skywalking will refresh the collected data every 6 seconds
Taking Eureka registry as an example, this paper demonstrates how to configure agent.
1.1 add the following configuration in VM options of Run/Debug Configurations in idea
1.2 add two lines of configuration in environment environment
SW_AGENT_NAME corresponds to the name of the service, which can be taken arbitrarily. The name of different instances of the same service is the same
1.3 for similar configurations, configure gateway (Gateway), one service (service 1, corresponding to two instances DemoClientone, DemoClientthree), and two service (service 2). Both service 1 and service 2 are connected to the local 3306 database. There are 5 applications in total, which are launched successively:
Registry - > Gateway - > Service 1 (two instances) - > service 2
Restart nginx
Why start nginx?
The actual access link is:
web browser / App/H5 applet - > initiate request - > nginx reverse proxy - > forward request to gateway - > gateway according to interface path - > route to different microservice instances
1.4 judge whether the agent is effective. When each application is started, the console will print first
1.5 wait a moment, you will find out in Skywalking UI
As you can see, there are four applications and one database, which are right
You can see the following information in the console later
1.1 dashboard - select one service, as shown below
1.2 topology - select one service, as shown below
1.3 tracking - select one service, as shown below
1.4 click Mysql/JDBC/PrepareStatement/execute in the figure above to see the following informationWhat if you want to see the parameters of executing SQL?
stay agent.config Configure. Set the following parameter to true
After configuration, restart. Request the interface again. Check the SQL calls in the call link as follows
Wait a moment, you can see the following information on the console
. 1 dashboard - select two service, as shown below
1.2 topology - select two service, as shown below
1.3 tracking - select two service, as shown below
As you can see, the whole call link is gateway > Two Service > one service
1.4 click Mysql/JDBC/PrepareStatement/execute in the figure above to see the following information
The topology of all microservice call links is as follows
Due to the official failure to provide the shutdown script, please refer to issue4698, You have to kill it by hand
Added by gaz_hayes on Sun, 14 Jun 2020 10:17:06 +0300
This page documents an earlier version of InfluxDB.InfluxDB v2.0 is the latest stable version.
InfluxQL offers a full suite of administrative commands.
Data Management: | Retention Policy Management: |
CREATE DATABASE | CREATE RETENTION POLICY |
DROP DATABASE | ALTER RETENTION POLICY |
DROP SERIES | DROP RETENTION POLICY |
DELETE | |
DROP MEASUREMENT | |
DROP SHARD |
If you’re looking for SHOW
queries (for example, SHOW DATABASES
or SHOW RETENTION POLICIES
), see Schema Exploration.
The examples in the sections below use the InfluxDB Command Line Interface (CLI).You can also execute the commands using the InfluxDB API; simply send a GET
request to the /query
endpoint and include the command in the URL parameter q
.For more on using the InfluxDB API, see Querying data.
Note: When authentication is enabled, only admin users can execute most of the commands listed on this page.See the documentation on authentication and authorization for more information.
Creates a new database.
CREATE DATABASE
requires a database name.
The WITH
, DURATION
, REPLICATION
, SHARD DURATION
, and NAME
clauses are optional and create a single retention policy associated with the created database.If you do not specify one of the clauses after WITH
, the relevant behavior defaults to the autogen
retention policy settings.The created retention policy automatically serves as the database’s default retention policy.For more information about those clauses, see Retention Policy Management.
A successful CREATE DATABASE
query returns an empty result.If you attempt to create a database that already exists, InfluxDB does nothing and does not return an error.
The query creates a database called NOAA_water_database
.By default, InfluxDB also creates the autogen
retention policy and associates it with the NOAA_water_database
.
The query creates a database called NOAA_water_database
.It also creates a default retention policy for NOAA_water_database
with a DURATION
of three days, a replication factor of one, a shard group duration of one hour, and with the name liquid
.
The DROP DATABASE
query deletes all of the data, measurements, series, continuous queries, and retention policies from the specified database.The query takes the following form:
Drop the database NOAA_water_database:
A successful DROP DATABASE
query returns an empty result.If you attempt to drop a database that does not exist, InfluxDB does not return an error.
The DROP SERIES
query deletes all points from a series in a database,and it drops the series from the index.
The query takes the following form, where you must specify either the FROM
clause or the WHERE
clause:
Drop all series from a single measurement:
Drop series with a specific tag pair from a single measurement:
Drop all points in the series that have a specific tag pair from all measurements in the database:
A successful DROP SERIES
query returns an empty result.
The DELETE
query deletes all points from aseries in a database.UnlikeDROP SERIES
, DELETE
does not drop the series from the index.
You must include either the FROM
clause, the WHERE
clause, or both:
Delete all data associated with the measurement h2o_feet
:
Delete all data associated with the measurement h2o_quality
and where the tag randtag
equals 3
:
Delete all data in the database that occur before January 01, 2020:
A successful DELETE
query returns an empty result.
Things to note about DELETE
:
DELETE
supportsregular expressionsin the FROM
clause when specifying measurement names and in the WHERE
clausewhen specifying tag values.DELETE
does not support fields in the WHERE
clause.DELETE SERIES
runs for time < now()
by default. SyntaxThe DROP MEASUREMENT
query deletes all data and series from the specified measurement and deletes themeasurement from the index.
The query takes the following form:
Delete the measurement h2o_feet
:
Note:DROP MEASUREMENT
drops all data and series in the measurement.It does not drop the associated continuous queries.
A successful DROP MEASUREMENT
query returns an empty result.
Currently, InfluxDB does not support regular expressions with DROP MEASUREMENTS
.See GitHub Issue #4275 for more information.
The DROP SHARD
query deletes a shard. It also drops the shard from themetastore.The query takes the following form:
Delete the shard with the id 1
:
A successful DROP SHARD
query returns an empty result.InfluxDB does not return an error if you attempt to drop a shard that does notexist.
The following sections cover how to create, alter, and delete retention policies.Note that when you create a database, InfluxDB automatically creates a retention policy named autogen
which has infinite retention.You may disable its auto-creation in the configuration file.
DURATION
DURATION
clause determines how long InfluxDB keeps the data.The <duration>
is a duration literalor INF
(infinite).The minimum duration for a retention policy is one hour and the maximumduration is INF
.REPLICATION
The REPLICATION
clause determines how many independent copies of each pointare stored in the cluster.
By default, the replication factor n
usually equals the number of data nodes. However, if you have four or more data nodes, the default replication factor n
is 3.
To ensure data is immediately available for queries, set the replication factor n
to less than or equal to the number of data nodes in the cluster.
Important: If you have four or more data nodes, verify that the database replication factor is correct.
SHARD DURATION
SHARD DURATION
clause determines the time range covered by a shard group.<duration>
is a duration literaland does not support an INF
(infinite) duration.DURATION
:Retention Policy’s DURATION | Shard Group Duration |
---|---|
< 2 days | 1 hour |
>= 2 days and <= 6 months | 1 day |
> 6 months | 7 days |
The minimum allowable SHARD GROUP DURATION
is 1h
.If the CREATE RETENTION POLICY
query attempts to set the SHARD GROUP DURATION
to less than 1h
and greater than 0s
, InfluxDB automatically sets the SHARD GROUP DURATION
to 1h
.If the CREATE RETENTION POLICY
query attempts to set the SHARD GROUP DURATION
to 0s
, InfluxDB automatically sets the SHARD GROUP DURATION
according to the default settings listed above.
SeeShard group duration managementfor recommended configurations.
DEFAULT
Sets the new retention policy as the default retention policy for the database.This setting is optional.
The query creates a retention policy called one_day_only
for the databaseNOAA_water_database
with a one day duration and a replication factor of one.
The query creates the same retention policy as the one in the example above, butsets it as the default retention policy for the database.
A successful CREATE RETENTION POLICY
query returns an empty response.If you attempt to create a retention policy identical to one that already exists, InfluxDB does not return an error.If you attempt to create a retention policy with the same name as an existing retention policy but with differing attributes, InfluxDB returns an error.
Note: You can also specify a new retention policy in the CREATE DATABASE
query.See Create a database with CREATE DATABASE.
The ALTER RETENTION POLICY
query takes the following form, where you must declare at least one of the retention policy attributes DURATION
, REPLICATION
, SHARD DURATION
, or DEFAULT
:
Replication factors do not serve a purpose with single node instances.
First, create the retention policy what_is_time
with a DURATION
of two days:
Modify what_is_time
to have a three week DURATION
, a two hour shard group duration, and make it the DEFAULT
retention policy for NOAA_water_database
.
In the last example, what_is_time
retains its original replication factor of 1.
A successful ALTER RETENTION POLICY
query returns an empty result.
Delete all measurements and data in a specific retention policy:
Dropping a retention policy will permanently delete all measurements and data stored in the retention policy.
Delete the retention policy what_is_time
in the NOAA_water_database
database:
A successful DROP RETENTION POLICY
query returns an empty result.If you attempt to drop a retention policy that does not exist, InfluxDB does not return an error.
Thank you for being part of our community!We welcome and encourage your feedback and bug reports for InfluxDB and this documentation.To find support, the following resources are available:
InfluxDB Cloud and InfluxDB Enterprise customers can contact InfluxData Support.