Updates from June, 2018 Toggle Comment Threads | Keyboard Shortcuts

  • Wang 21:38 on 2018-06-30 Permalink | Reply
    Tags: , , , ,   

     
  • Wang 23:12 on 2018-06-28 Permalink | Reply
    Tags: ,   

    [ELK] Enable X-Pack in ELK stack 6.3 

    We konw X-Pack is is an extension that bundles security, monitoring, reporting, and graph capabilities into one package.

    From ELK stack 6.3, X-Pack is integrated into Elasticsearch, you can try it by 30-day-trial license. After the trail you could choose buy the license or downgrade to the normal license.

    ES

    1.Down & Unzip & Enter

    wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-6.3.2.tar.gz
    tar -zvxf elasticsearch-6.3.2.tar.gz && cd elasticsearch-6.3.2
    

    2.Enable monitor & Start

    echo "xpack.monitoring.enabled: true" >>config/elasticsearch.yml
    echo "xpack.security.enabled: true" >>config/elasticsearch.yml
    echo "xpack.watcher.enabled: true" >>config/elasticsearch.yml
    echo "xpack.ml.enabled: true" >>config/elasticsearch.yml
    echo "xpack.graph.enabled: true" >>config/elasticsearch.yml
    echo "xpack.monitoring.collection.enabled: true" >>config/elasticsearch.yml
    
    bin/elasticsearch
    

    Kibana

    1.Download & Unzip & Entry

    wget wget https://artifacts.elastic.co/downloads/kibana/kibana-6.3.2-darwin-x86_64.tar.gz
    tar -zvxf kibana-6.3.2-darwin-x86_64.tar.gz && cd kibana-6.3.2-darwin-x86_64
    

    2.Start

    bin/kibana
    

    3.Visit kibana, http://localhost:5601, you will see the dashboard, next we will enable 30-day-trail license.

    3.1.Click Management on left menu

    3.2.Click License Management

    3.3.Click Start trial button

    3.4.Click Start my trial button

    3.5.Start trail license done


    X-Pack

    1.Enter elasticsearch directory, execute command as below to generate password for users, please choose one

    bin/elasticsearch-setup-passwords interactive(you need to enter password for every user)
    bin/elasticsearch-setup-passwords auto(will generate password for users automatically)
    

    2.Enter kibana directory, stop kibana and set username/password in kibana.yml, then start kibana

    echo "elasticsearch.username: kibana" >>config/kibana.yml
    echo "elasticsearch.password: kibana123" >>config/kibana.yml
    
    bin/kibana
    

    3.After finishing all the settings, you will see the login page

    4.Enter the username/password which you set in kibana.yml, then you could login success

     
  • Wang 19:45 on 2018-06-22 Permalink | Reply
    Tags: , , , scala,   

    [Gatling] Customize your scripts based on scenario 

    Sometimes record function may not fulfill your requirement, in this case you need write scala script yourself according to gatling document.

    Below is a simple sample to test two APIs: employee & health check

    package me.hongmeng.stress.test
    
    import io.gatling.core.Predef._
    import io.gatling.http.Predef._
    
    class SimpleSimulation extends Simulation {
    
      val hostname = "http://localhost:8080"
    
      val httpProtocol = http
        .baseURL(hostname)
        .inferHtmlResources()
        .acceptHeader("*/*")
        .contentTypeHeader("application/json")
        .userAgentHeader("Gatling/2.3.1")
    
      val headers = Map("accept-encoding" -> "gzip, deflate", "cache-control" -> "no-cache")
    
      val employeeScenario = scenario("create_experiment_simulation")
        .exec(
          http("employee")
            .post("/v1/employees")
            .headers(headers)
            .body(
              StringBody("{"name": "xiaowang","major": "software"}")
            )
        )
    
      val healthScenario = scenario("health_simulation")
        .exec(
          http("health_check")
            .get("/actuator/health")
            .headers(headers)
        )
    
      setUp(
          employeeScenario.inject(atOnceUsers(10)),
          healthScenario.inject(atOnceUsers(10))
        ).protocols(httpProtocol)
    }
    
     
  • Wang 21:21 on 2018-06-13 Permalink | Reply
    Tags: , , ,   

    [Gatling] Know about stress test tool 

    Gatling is kind of stress test tool to test your app’s performance, for detail infos, please refer to official document.

    Next I will summurize how to install gatling on your Macbook.

    1.Download gatling

    wget https://repo1.maven.org/maven2/io/gatling/highcharts/gatling-charts-highcharts-bundle/2.3.1/gatling-charts-highcharts-bundle-2.3.1-bundle.zip
    

    2.Unzip & Enter

    unzip gatling-charts-highcharts-bundle-2.3.1-bundle.zip & cd gatling-charts-highcharts-bundle-2.3.1-bundle
    

    3.Start record function

    bin/record.sh
    

    After starting record script, you could see the UI as below:

    Please configure the proxy port and click Start button. Then you could set your browser proxy and surf the target URL, gatling will capture the content as below:

    If you finished and wanna save the result, please click Stop & Save button, gatling will generate a new scala script which save all your behaviors just now, and the script will be under user-files/simulations/

    xxx@xxx 2.3.1 $ ll user-files/simulations/
    total 328
    drwxr-xr-x@ 4 1154257814  80     136 Aug 13 11:30 .
    drwxr-xr-x@ 5 1154257814  80     170 Mar  6 22:59 ..
    -rw-r--r--  1 1154257814  80  166657 Aug 13 11:54 RecordedSimulation.scala
    drwxr-xr-x@ 4 1154257814  80     136 Mar  6 22:59 computerdatabase
    

    If you wanna change the generated file location, please modify outputFolder in conf/recorder.conf

    hongmeng.wang@X0621 2.3.1 $ cat conf/recorder.conf 
    recorder {
        core {
            className=RecordedSimulation
            encoding=utf-8
            harFilePath=""
            headless=false
            mode=Proxy
            outputFolder="/usr/local/Cellar/gatling/2.3.1/user-files/simulations"
            package=""
            ...
            ...
    
     
c
Compose new post
j
Next post/Next comment
k
Previous post/Previous comment
r
Reply
e
Edit
o
Show/Hide comments
t
Go to top
l
Go to login
h
Show/Hide help
shift + esc
Cancel
%d bloggers like this: