CentOS 6 SkyWalking do to build distributed tracking

Apache Skywalking (Incubator) Introduction

Apache Skywalking (Incubator) specifically for micro-services architecture and native cloud-based systems and is designed to support distributed link tracking APM system, namely application performance monitoring systems, micro Services Architecture and native cloud-based systems design. It automatically collects the required metrics through the probe, and distributed track. By calling these links and index, Skywalking APM will perceive the relationship between the relationship between applications and services, and the corresponding index statistics. Link currently supports tracking and monitoring application components as follows, covering the mainstream framework and containers, such as domestic PRC Dubbo and motan other international spring boot, spring cloud are supported. Apache Skywalking (Incubating) currently supports multiple languages, including Java, .Net Core, Node.js and Go language.

skywalaking overall architecture is divided into three parts

  • skywalking-collector: Link Data imputation, data can fall ElasticSearch, can also be stand-alone floor H2, is not recommended, H2 used only as a temporary demo
  • skywalking-web: web visualization platform, data used to display the floor
  • skywalking-agent: Probe for collecting and transmitting data to an imputation

Centos6 do distributed build SkyWalking track

Apache Skywalking (Incubator) a total of two deployment modes: single-ended mode and trunked mode, the mode is the single-node deployment steps.

Dependent on third-party components

  • JDK8 +
  • Mysql5.6 (not recommended)
  • ElasticSearch: 6.x

Environment Configuration

  • skywalking-collector Services: 192.168.1.100
  • skywalking-web services: 192.168.1.101
  • ES cluster: 192.168.1.102

Installation ES cluster (recommended)

Installing MySQL database (not recommended)

http://dev.mysql.com/get/mysql-community-release-el6-5.noarch.rpm wget 
the sudo yum MySQL localinstall -Y-Community-Release-EL6 -. * .noarch.rpm 
yum the install MySQL-Server MySQL libmysqlclient-dev -client 

/etc/init.d/mysqld Start 
mysql_secure_installation #MySQL security configuration Wizard 
  Enter current password for root (enter for none): <- initial run directly enter 
  Set root password [Y / n] <- if? set the root user password, enter y and press enter, or just press enter 
  remove anonymous users [y / n] <-? whether to remove the anonymous user, proposed to delete the production environment, it can directly enter 
  Disallow root login remotely [y / n ] <? - prohibit root remote login, select Y / n according to their needs and press Enter, proposed to prohibit 
  Remove test database and access to it [ Y / n] <-? whether to delete the test database, directly enter 
  Reload privilege tables now [? Y / n] <- reloading whether permission table, directly enter

// modify the configuration file

cat /etc/my.cnf
---------------------------------------------------------------------------------
[mysqld]
port=3319
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
pid-file=/var/run/mysqld/mysqld.pid

innodb_large_prefix=on
innodb_file_format=Barracuda

# time zone
default-time-zone=system
character-set-server=utf8
default-storage-engine=InnoDB

skip-name-resolve
skip-symbolic-links
skip-external-locking
skip-slave-start

# res settings
back_log=128
max_connections=100
max_connect_errors=2000
#open_files_limit=10240

connect-timeout=10
wait-timeout=28800
interactive-timeout=28800
innodb_thread_concurrency=0 #不限制并发

# slow query log
slow_query_log=1
long-query-time=3 #慢查询时间
slow_query_log_file=/data/logs/mysql/slow.log

log-warnings=1
log-error=/data/logs/mysql/mysql.err
log_output=FILE

general_log=1
general_log_file=/data/logs/mysql/mysql.log
max_binlog_size=1G
max_relay_log_size=1G

innodb_additional_mem_pool_size=16M
innodb_buffer_pool_instance=2
innodb_buffer_pool_size=256M
innodb_file_io_threads=4
innodb_flush_log_at_trx_commit=2
innodb_log_buffer_size=5M
innodb_log_file_size=100M

innodb_log_files_in_group=2
innodb_log_group_home_dir=/data/mysql/var/
innodb_old_blocks_pct=20
innodb_buffer_pool_dump_at_shutdown=1
innodb_buffer_pool_dump_now=1
innodb_buffer_pool_load_at_startup=1
innodb_buffer_pool_load_now=1
innodb_buffer_pool_filename=ib_buffer_pool

innodb_max_dirty_pages_pct=90
innodb_lock_wait_timeout=50

symbolic-links=0
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES

[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid

[mysql]
disable-auto-rehash
default-character-set=utf8
connect-timeout=3

// Create the configuration directory

mkdir -p /data/logs/mysql
mkdir -p /data/mysql/var
chown -R mysql:mysql /data/mysql/var
chown -R mysql:mysql /data/logs/mysql

// restart mysql

/etc/init.d/mysqld restart

Configuring Skywalking Collector Service

cd /data/packages/
wget http://mirrors.hust.edu.cn/apache/incubator/skywalking/6.0.0-GA/apache-skywalking-apm-incubating-6.0.0-GA.tar.gz
tar zxvf apache-skywalking-apm-incubating-6.0.0-GA.tar.gz
mv apache-skywalking-apm-incubating /opt/skywalking
ll /opt/skywalking

Centos6 do distributed build SkyWalking track

Storage configuration monitoring data ES (recommended)
stored by the elasticsearch to modify h2:

storage:
# h2:
#   driver: org.h2.jdbcx.JdbcDataSource
#   url: jdbc:h2:mem:skywalking-oap-db
#   user: sa
  elasticsearch:
    clusterName: elk-cluster
    clusterNodes: 192.168.1.102:9200
    indexShardsNumber: 2
    indexReplicasNumber: 0
    # Batch process setting, refer to https://www.elastic.co/guide/en/elasticsearch/client/java-api/5.5/java-docs-bulk-processor.html
    bulkActions: 2000 # Execute the bulk every 2000 requests
    bulkSize: 20 # flush the bulk every 20mb
    flushInterval: 10 # flush the bulk every 10 seconds whatever the number of requests
    concurrentRequests: 2 # the number of concurrent requests

The main changes which clusterName and clusterNodes and has started elasticsearch configuration consistent.

Mysql configuration monitoring data storage (not recommended)
1, h2 stored as a modified embodiment mysql:

CD / opt / skywalking 
# modify config / application.yml (# modify storage portion, commented h2, open mysql, other remains immobile): 

Core: 
  default: 
    restHost: 127.0.0.1 
    restPort: 12800 
    restContextPath: / 
    gRPCHost: 127.0. 0.1 
    gRPCPort: 11800 
Storage: 
# H2: 
# Driver: $ {SW_STORAGE_H2_DRIVER: org.h2.jdbcx.JdbcDataSource} 
# URL: $ {SW_STORAGE_H2_URL: JDBC: H2: MEM: DB-skywalking-OAP} 
# User: $ {SW_STORAGE_H2_USER: } SA 
.................... omitted N rows ....................... ................... 
# set mysql to store monitoring data 
  mysql: # cancel this line comments
#配置datasource, 修改 config/datasource-settings.properties 配置如下:

jdbcUrl=jdbc:mysql://localhost:3319/swtest
dataSource.user=root
dataSource.password=<your_pass>
dataSource.cachePrepStmts=true
dataSource.prepStmtCacheSize=250
dataSource.prepStmtCacheSqlLimit=2048
dataSource.useServerPrepStmts=true
dataSource.useLocalSessionState=true
dataSource.rewriteBatchedStatements=true
dataSource.cacheResultSetMetadata=true
dataSource.cacheServerConfiguration=true
dataSource.elideSetAutoCommits=true
dataSource.maintainTimeStats=false

2, to download the driver package mysql oap-libs directory
Download: http://central.maven.org/maven2/mysql/mysql-connector-java/

cd /opt/skywalking/oap-libs/
wget http://central.maven.org/maven2/mysql/mysql-connector-java/5.1.47/mysql-connector-java-5.1.47.jar

3, enter the mysql database to create swtest

[root@skywalking ]# mysql -uroot -p<your_pass>
mysql> CREATE DATABASE swtest;
Query OK, 1 row affected (0.00 sec)

Start collector Services

# Initialize 
cd / opt / skywalking / bin / 
./oapServiceInit.sh 

# start the collector service 
./oapService.sh

Configuring Skywalking Web services
1, modify the configuration

cd / opt / skywalking / the webapp 
# webapp.yml modify the configuration file as follows: 
Server: 
  Port: 8080 
Collector: 
  path: / graphql 
  Ribbon: 
    ReadTimeout: 10000 
    # Point to All backend's restHost: restPort, Split by, 
    listOfServers: 127.0.0.1: 12800 
Security: 
  the User: 
    # username 
    ADMIN: 
      # password 
      password: <your_pass> # here to change your password webmaster

2, start web service

cd /opt/skywalking/bin
./webappService.sh

startup.sh at the start bin directory can be started up with the collector and Web modules.

If all goes well, this time you can view SkyWalking UI by http://192.168.1.100:8080, default account / password: admin / admin.

Probe configuration (Agent)

1, was monitoring client download skywalking

httpmirrorshusteducnapacheincubatorskywalking600GAapacheskywalkingapmincubating600GAtargz programs wget 
tar zxvf apache-skywalking-apm GAtargz-600-incubating 
the mv apache-skywalking-incubating-apm / opt / skywalking

2, the configuration changes agent.config probe configuration is as follows:

/opt/skywalking/agent/config/agent.config vim 
------------------------------------- ------------------------ 
agent.service_name # = Your_ApplicationName change your project name 
collector.backend_service = 192.168.1.100: 11800 #collector port services address; 
logging.level info =

3, start Agent

  • Tomcat-based services (SpringMvc)
    add the following command line catalina.sh bin directory in tomcat

    CATALINA_OPTS="$CATALINA_OPTS -javaagent:/opt/skywalking/agent/skywalking-agent.jar"
    export CATALINA_OPTS
  • Based JAR file services (SpringBoot)
    added to start your application's command line parameters and -javaagent sure to add it before -jar parameters such as..:
    java -javaagent:/opt/skywalking/agent/skywalking-agent.jar -jar yourApp.jar

Then restart the service, you can see the data on the page; if other errors occur, review the log detail investigation; collector logs and Web logs are in the log directory SkyWalking root directory (starts at collector after you have created); Agent directory is under the agent directory.

Guess you like

Origin www.linuxidc.com/Linux/2019-08/159731.htm