This page documents an earlier version of InfluxDB.InfluxDB v2.0 is the latest stable version.See the equivalent InfluxDB v2.0 documentation:Get started with InfluxDB.
Findコマンドでfind 全ディレクトリを検索対象する方法を記述してます。ちなみに、locateはデータが肥大化するのが嫌なので、遅いけどfindを利用してます。. InfluxDB v2.0 is the latest stable version. InfluxQL offers a full suite of administrative commands. 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). Note that /var/lib/influxdb is the default folder for a Linux installation. You need to modify it depending on your configuration. If you need to restore a backup on your Scalingo server, please contact our support at support@scalingo.com. Why you cannot manage the backups for InfluxDB on Scalingo.
With InfluxDB open source (OSS) installed, you’re ready to start doing some awesome things.In this section we’ll use the influx
command line interface (CLI), which is included in allInfluxDB packages and is a lightweight and simple way to interact with the database.The CLI communicates with InfluxDB directly by making requests to the InfluxDB API over port 8086
by default.
Note: The database can also be used by making raw HTTP requests.See Writing Data and Querying Datafor examples with the curl
application.
Creating a database
If you’ve installed InfluxDB locally, the influx
command should be available via the command line.Executing influx
will start the CLI and automatically connect to the local InfluxDB instance(assuming you have already started the server with service influxdb start
or by running influxd
directly).The output should look like this:
Notes:
- The InfluxDB API runs on port
8086
by default.Therefore,influx
will connect to port8086
andlocalhost
by default.If you need to alter these defaults, runinflux --help
. - The
-precision
argument specifies the format/precision of any returned timestamps.In the example above,rfc3339
tells InfluxDB to return timestamps in RFC3339 format (YYYY-MM-DDTHH:MM:SS.nnnnnnnnnZ
).
The command line is now ready to take input in the form of the Influx Query Language (a.k.a InfluxQL) statements.To exit the InfluxQL shell, type exit
and hit return.
A fresh install of InfluxDB has no databases (apart from the system _internal
),so creating one is our first task.You can create a database with the CREATE DATABASE <db-name>
InfluxQL statement,where <db-name>
is the name of the database you wish to create.Names of databases can contain any unicode character as long as the string is double-quoted.Names can also be left unquoted if they contain only ASCII letters,digits, or underscores and do not begin with a digit.
Throughout this guide, we’ll use the database name mydb
: Natural bristle paint brushes.
Note: After hitting enter, a new prompt appears and nothing else is displayed.In the CLI, this means the statement was executed and there were no errors to display.There will always be an error displayed if something went wrong.No news is good news!
Now that the mydb
database is created, we’ll use the SHOW DATABASES
statementto display all existing databases:
Note: The _internal
database is created and used by InfluxDB to store internal runtime metrics.Check it out later to get an interesting look at how InfluxDB is performing under the hood.
Unlike SHOW DATABASES
, most InfluxQL statements must operate against a specific database.You may explicitly name the database with each query,but the CLI provides a convenience statement, USE <db-name>
,which will automatically set the database for all future requests. For example:
Now future commands will only be run against the mydb
database.
Writing and exploring data
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 “cpu_load” or “temperature”.Time series have zero to many points
, one for each discrete sample of the metric.Points consist of time
(a timestamp), a measurement
(“cpu_load”, for example),at least one key-value field
(the measured value itself, e.g.“value=0.64”, or “temperature=21.2”), and zero to many key-value tags
containing any metadata about the value (e.g.“host=server01”, “region=EMEA”, “dc=Frankfurt”).
Conceptually you can think of a measurement
as an SQL table,where the primary index is always time.tags
and fields
are effectively columns in the table.tags
are indexed, and fields
are not.The difference is that, with InfluxDB, you can have millions of measurements,you don’t have to define schemas up-front, and null values aren’t stored.
Points are written to InfluxDB using the InfluxDB line protocol, which follows the following format:
The following lines are all examples of points that can be written to InfluxDB:
Note: For details on the InfluxDB line protocol, see InfluxDB line protocol syntax page.
To insert a single time series data point into InfluxDB using the CLI, enter INSERT
followed by a point:
A point with the measurement name of cpu
and tags host
and region
has now been written to the database, with the measured value
of 0.64
.
Now we will query for the data we just wrote:
Note: We did not supply a timestamp when writing our point.When no timestamp is supplied for a point, InfluxDB assigns the local current timestamp when the point is ingested.That means your timestamp will be different.
Let’s try storing another type of data, with two fields in the same measurement:
To return all fields and tags with a query, you can use the *
operator:
Warning: Using *
without a LIMIT
clause on a large database can cause performance issues.You can use Ctrl+C
to cancel a query that is taking too long to respond.
InfluxQL has many features and keywords that are not covered here,including support for Go-style regex. For example:
This is all you need to know to write data into InfluxDB and query it back.To learn more about the InfluxDB write protocol,check out the guide on Writing Data.To further explore the query language,check out the guide on Querying Data.For more information on InfluxDB concepts, check out the [Key Concepts](/influxdb/v1.8/concepts/key_concepts/) page.
Support and feedback
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.
Article catalog
background
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
Install Elasticsearch and start
- Installation command (the following command is Mac command, and yum command can be used under Linux. Under Windows, you can directly use yum command in Elasticsearch official website Download the installation package of the corresponding version.)
- Start elasticsearch
- Check whether the startup is successful
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
Install SkyWalking and start
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
1password for m1 camera. 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
Agent for configuring spring cloud microservices
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
View the link call of spring cloud
Single microservice call monitoring
- Request an instance of one service, the interface of DemoClientone, addSwUser interface, and insert a piece of data.
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
Call link monitoring between microservices
- Call between microservices, external interface requests two-service, and DemoClienttwo load balancing requests two instances (DemoClientone, DemoClientthree) under one service.
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
All microservice call links
Metabase Query Builder
The topology of all microservice call links is as follows
Stop SkyWalking
Due to the official failure to provide the shutdown script, please refer to issue4698, You have to kill it by hand
Create Influxdb Database
- Shut down Agent
Stop Elasticsearch
summary
- Quickly use SkyWalking to complete simple detection of microservice architecture of spring cloud class
- How to use the alarm function?
- The above calls are just micro service calls, but also very single. For micro service clusters, such as registry cluster, gateway cluster, and business cluster (one actual business service, multiple instance nodes). In the case of clustering, how to smoothly adapt the services in the cluster to SkyWalking and be detected?
- For cluster configuration, how to combine configuration center to make configuration simple and easy to use?
- Because the front of gateway cluster may be Nginx cluster, how to include Nginx cluster into SkyWalking management?
Delete Database In Influx
Added by gaz_hayes on Sun, 14 Jun 2020 10:17:06 +0300