Rate This Document
Findability
Accuracy
Completeness
Readability

Creating Directories for Esrally

Creating a tracks Directory

  1. Create a tracks directory.
    1
    2
    cd /root/.rally/
    mkdir -p benchmarks/tracks/default/
    
  2. Download tracks and save the downloaded directory to benchmarks/tracks/default/.
    1
    cp -a rally-tracks/geonames benchmarks/tracks/default/
    
  3. Go to the benchmarks/tracks/default/ directory.
    1
    cd benchmarks/tracks/default/
    
  4. Create a Git repository.
    1
    2
    3
    git init
    git config --global user.email
    git config --global user.name
    
  5. Run the git command to save the data to the local database.

    Perform this step after the configuration is modified. You need to perform this step each time you modify the configuration.

    git add geonames/*
    git commit -a -m "add geonames"

Creating a teams Directory

  1. Create a directory.
    1
    mkdir -p /root/.rally/benchmarks/teams/default/
    
  2. Download teams and save the downloaded directory to rally-teams/cars benchmarks/teams/default/.
    1
    cp -a rally-teams/cars benchmarks/teams/default/
    
  3. Go to the rally-teams/cars benchmarks/teams/default/ directory.
    1
    cd benchmarks/teams/default/
    
  4. Create a Git repository.
    1
    git init
    
  5. Run the git command to save the data to the local database.

    Perform this step after the configuration is modified. You need to perform this step each time you modify the configuration.

    1
    git add cars
    

Creating a data Directory

  1. Create a directory.
    1
    mkdir -p benchmarks/data/geonames
    
  2. Download data samples.
    1
    wget http://download.geonames.org/export/dump/allCountries.zip
    
  3. Decompress allCountries.zip.
    1
    unzip allCountries.zip -d benchmarks/data/geonames
    
  4. Create a format conversion script.
    1. Create a script file.
      1
      vi toJSON.py
      
    2. Press i to enter the insert mode and edit the script file as follows:
      import json​
      cols = (("geonameid", "int", True), 
      ("name", "string", True), 
      ("asciiname", "string", False), 
      ("alternatenames", "string", False), 
      ("latitude", "double", True), 
      ("longitude", "double", True), 
      ("feature_class", "string", False), 
      ("feature_code", "string", False), 
      ("country_code", "string", True), 
      ("cc2", "string", False), 
      ("admin1_code", "string", False), 
      ("admin2_code", "string", False), 
      ("admin3_code", "string", False), 
      ("admin4_code", "string", False), 
      ("population", "long", True), 
      ("elevation", "int", False), 
      ("dem", "string", False), 
      ("timezone", "string", False))​​
      
      def main(): 
          with open("allCountries.txt", "rt", encoding="UTF-8") as f: 
               for line in f: 
                   tup = line.strip().split("\t") 
                   record = {} 
                  for i in range(len(cols)): 
                      name, type, include = cols[i] 
                      if tup[i] != "" and include: 
                         if type in ("int", "long"): 
                            record[name] = int(tup[i]) 
                            elif type == "double": 
                            record[name] = float(tup[i]) 
                            elif type == "string": 
                            record[name] = tup[i] 
                  print(json.dumps(record, ensure_ascii=False))
      
      if __name__ == "__main__":
      main()
    3. Press Esc, type :wq!, and press Enter to save the file and exit.
  5. Assign the execution permission on the script.
    1
    chmod +x toJSON.py
    
  6. Go to the benchmarks/data/geonames/ directory and perform the conversion.
    1
    2
    cd benchmarks/data/geonames/
    python3 /root/.rally/benchmarks/teams/default/toJSON.py > documents.json