Log【2022/12】

本文档详细介绍了Ottertune系统的配置与部署流程,涵盖了Linux环境下MySQL、PostgreSQL、Docker、Celery、RabbitMQ等关键组件的安装与配置方法,并提供了Ottertune自身的调试启动指南。

Otthertune[2022/12]

Ref

Sum

Linux Usage

  • check thread ps aux --sort=lstart

Mysql

  • mysql install
    sudo apt-get install mysql-server
    apt install mysqlclient
    apt-get install libmysqlclient-dev
    pip install mysqlclient==1.3.12
    sudo apt-get install python-pip python-dev python-mysqldb rabbitmq-server
    # usr:root passwd:xiaotong 
    
  • mysql use:
    mysql -u root -p
    # passwd xiaotong
    

Postgresql

  • download from tar.gz website and decompress
    tar -xvf [.tar.gz]
    cd []
    
  • compile and build
    apt-get install libreadline5 # readline
    apt-get install libreadline6-dev # readline
    apt-get install zlib1g.dev # zlib
    ./configure --prefix=/usr/pgsql9.6/ #prefix means the install path
    make
    make install
    
    then pgsql9.6 is installed at /usr/pgsql9.6
  • init postgres see blog
    cd /usr/pgsql9.6
    mkdir data
    adduser postgres # passwd: postgres
    chown postgres data
    su postgres
    cd /usr/pgsql9.6
    bin/initdb -D data
    # bin/pg_ctl -D data -l logfile start
    bin/pg_ctl -D data start
    bin/createdb test
    bin/psql test
    
  • start postgres see blog
    # bin/pg_ctl -D data -l logfile start
    bin/pg_ctl -D data start
    bin/createdb test
    bin/psql test
    
  • postgres use:
    su postgres # passwd postgres
    /usr/pgsql9.6/bin/psql
    

Docker

docker build -t ottertune-base -f ./docker/Dockerfile.base .
docker build -t ottertune-driver -f ./docker/Dockerfile.driver .
docker build -t ottertune-web -f ./docker/Dockerfile.web .
docker imgages # see image
docker rmi -f [image_id]
docker ps -a # see container
docker rm -f [container_id]
docker-compose -f docker-compose.build.yml build # build image
docker-compose -f docker-compose.yml up # build container
docker inspect --format '{{.LogPath}}' [container id] #return log file can see log file via `vim`
cd /root/ottertune/
bash install_images.sh
cd docker
BACKEND=postgresql WEB_ENTRYPOINT="''" sh create-docker-compose.sh $dcfile_postgres # from .travis.yml
docker-compose -f docker-compose.yml up
docker cp [source file name] [container id]:[target file name]
docker exec -it [container name] /bin/bash

Celery

  • asynchronous message queueing
  • celery = message broker + worker + task result store
  • work with rabbitmq/reddis
    • with reddis see celery blog
      tar+make install redis-6.2.7 
      pip install redis==2.10.6
      pip install celery==3.1.24
      # celery_task.py --> `celery worker -A celery_task -l info`
      # produce_task.py --> `python produce_task.py`
      # result.py --> python result.py --id [id get from produce_task.py]
      
      tutorial video
    • with rabbitmq see rabbitmq tutorial
      python receive.py
      python send.py
      

RabbitMQ

  • stop app rabbitmqctl stop_app
  • see queue list status rabbitmqctl list_queues
  • see status rabbitmqctl status
  • clear all queues in rabbitmq rabbitmqctl reset
  • clear item in rabbitmq rabbitmqctl purge_queue celery
  • restart rabbitmq bash rabbitmq_restart.sh
    rabbitmqctl stop_app
    rabbitmqctl reset
    rabbitmqctl start_app
    rabbitmqctl list_queues
    

Ottertune

  • debug ottertune
    # in /root/ottertune/server/website
    fab -f script/management/fabfile.py start_debug_server
    # in /root/ottertune/client/driver
    fab -f /root/ottertune/client/driver/fabfile.py loop:i=10
    # check port usage
    netstat -anp | grep 8000
    # put breakpoint
    rdb.set_trace() # tong 11/29
    # telnet 
    telnet localhost [port] # port may change
    

Django

  • version dependency

Philosophy

  • FIND A PROPER START POINT
  • version dependency 99%
  • ACID: Atomic (rerun the whole pipeline if err)

Ottertune[2022/11]

🌟see blog

env set log

python=3.6.13

project 🌟

Goal: AI tune DB

archi

  • ottertune = server + client
  • server = mysql (store training data) + Django (UI) + Celery (ML task schedule)
  • client = target dbms + controller + driver
    controller control target dmbs
    driver control controller
  • [外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-YiPaygWa-1670479625855)(image/2.png)]

env set

  • ottertune = server set + client set
    [外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-PZLuBSgt-1670479625856)(image/638051-20190529035020576-798495823.png)]
  • need oltpbench for create wkld and run wkld get result

oltpbench

  • generate and run wkld --> get performance
  • otlpbenchmark git repo
  • ./oltpbenchmark -b tpcc -c config/tpcc_config.xml --create=true --load=true -s 10 -o outputfile
  • result of cmd
    [外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-OhdQ9qah-1670479625856)(image/3.png)]

Ref

  1. OtterTune源码解析
  2. otlpbenchmark git repo
  3. ottertune git repo

Sum 🌟

python install

  • see available python and do something with them
    Run python and see the version of it. You can also check the folder /usr/local/bin or /usr/bin since python is always installed there.
    python import sys print(sys.executable)

  • get pakage from website see 菜鸟教程python安装

  • choose a proper version (ps: the hardest part)
    We take python3.7.0 as example

  • compile and build (ps: python depends on gcc)

    ./configure
    make
    make install
    
  • build soft link (ps: for mvc)

    ln -s /usr/bin/python /usr/local/bin/python3.7 # when type `python`, you actually run `python3.7` useful for mvc
    ln -s /usr/local/bin/python3.7 /usr/bin/python
    
  • try and test: make sure you really install the python properly

  • how to choose python version❓

    It depends on the pakcage that your project need --> get info from repo or try (ps: I am confused with this part😭)

network 🌟

  • do this part first❗️
  • basic idea: network need dns & domestic image
  • set dns set dns
  • Warning: You can only have 3 dns ip❗️
    vim /etc/resolv.conf # tmp
    vim /etc/resolvconf/resolv.conf.d/base # perm   
    # nameserver 10.3.3.3
    # nameserver 114.114.114.114
    # nameserver 8.8.8.8 
    
  • domestic image
    vim /etc/apt/sources.list
    # add the proper content from [网络设置清华源](https://mirror.tuna.tsinghua.edu.cn/help/ubuntu/)
    
  • reboot the server

pip install

  • sudo apt-get install pip
  • python get-pip.py (ps: recommend)
    Install get-pip.py from website and run python get-pip.py.
  • install pip from pypi
    website contains python’s all pakcages, which inlude pip. You can install pip like other pakages.

pakage install

  • pip install [pakage name] (ps: need pip)
  • pip install [pakage name] -i [domestic image]
    you can choose domestic image from below
    https://pypi.tuna.tsinghua.edu.cn/simple/	# 清华大学
    https://mirrors.aliyun.com/pypi/simple/		# 阿里云
    https://pypi.douban.com/simple/				# 豆瓣
    https://pypi.mirrors.ustc.edu.cn/simple/	# 中国科学技术大学
    https://pypi.hustunique.com/	
    # ————————————————
    # 版权声明:本文为优快云博主「Doris404」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
    # 原文链接:https://blog.youkuaiyun.com/kullollo/article/details/109448254
    
  • install pakage.tar.gz from pypi and run cd [pakage] & python setup.py install
  • install pakage from pakage.whl in pypi and run pip install [pakage.whl]

Philosophy

goal first

  • don’t update software frequently (ps: update pip)
  • see only the important info (ps: warning is ok, useless err is ok)
    [外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-E9YUU5Sw-1670479625856)(image/4.png)]
    easy first
  • passwd free login how to set passwd free login
    ssh-copy-id -i /Users/xiaotong/.ssh/id_rsa.pub root@[ip]
    

log and checkpoint

  • this README.md
  • env set will last long time log and checkpoint will keep you clear
C:\Users\xiaom> dir %windir% 驱动器 C 中的卷是 OS 卷的序列号是 782A-9544 C:\Windows 的目录 2025/07/29 23:57 <DIR> . 2023/11/02 07:48 <DIR> appcompat 2025/07/12 17:52 <DIR> apppatch 2025/07/27 00:15 <DIR> AppReadiness 2023/09/14 01:04 102 AsPEToolVer.txt 2023/11/06 00:05 <DIR> assembly 2023/09/13 09:46 <DIR> ASUS 2023/09/13 09:46 230 ASUS_IMAGE.Ver 2024/02/14 15:28 <DIR> bcastdvr 2023/11/15 14:32 110,592 bfsvc.exe 2022/05/07 13:42 <DIR> Boot 2022/05/07 13:24 <DIR> Branding 2024/02/14 15:28 <DIR> BrowserCore 2025/07/22 20:39 <DIR> CbsTemp 2022/05/07 13:24 <DIR> Containers 2022/05/07 13:20 23,461 CoreCountrySpecific.xml 2022/06/03 08:34 10 csup.txt 2022/05/07 13:24 <DIR> Cursors 2024/04/18 00:30 <DIR> debug 2023/09/13 09:51 32,388 diagerr.xml 2022/05/07 13:42 <DIR> diagnostics 2023/11/15 22:33 <DIR> DiagTrack 2023/09/13 09:51 32,388 diagwrn.xml 2022/05/07 18:17 <DIR> DigitalLocker 2024/10/04 21:20 <DIR> Downloaded Installations 2022/05/07 18:17 <DIR> en-US 2024/02/14 14:43 5,356,504 explorer.exe 2023/11/01 18:10 <DIR> Firmware 2022/05/07 13:24 <DIR> GameBarPresenceWriter 2023/11/01 18:31 <DIR> Globalization 2022/05/07 18:17 <DIR> Help 2023/12/13 12:32 1,093,632 HelpPane.exe 2022/05/07 13:20 36,864 hh.exe 2022/05/07 13:42 <DIR> IdentityCRL 2022/05/07 18:17 <DIR> IME 2024/12/29 23:52 <DIR> ImmersiveControlPanel 2023/12/13 13:28 <DIR> InboxApps 2025/07/29 18:58 <DIR> INF 2022/05/07 13:42 <DIR> InputMethod 2022/05/07 13:24 <DIR> L2Schemas 2025/02/17 13:49 <DIR> LastGood 2025/01/22 21:28 <DIR> LastGood.Tmp 2025/03/27 08:37 <DIR> LiveKernelReports 2025/07/24 19:56 <DIR> Log 2025/07/22 19:44 <DIR> Logs 2022/05/07 13:42 <DIR> Media 2022/05/07 13:19 43,131 mib.bin 2025/07/26 19:51 <DIR> Microsoft.NET 2022/05/07 13:24 <DIR> Migration 2025/06/27 14:07 <DIR> Minidump 2022/05/07 13:24 <DIR> ModemLogs 2023/11/01 17:11 <DIR> Netease 2024/02/14 14:43 360,448 notepad.exe 2024/10/03 20:50 637,378 ntbtlog.txt 2025/04/07 23:51 1,951 NvContainerRecovery.bat 2022/05/07 18:18 <DIR> OCR 2023/09/13 09:46 <DIR> OEM 2022/05/07 13:24 <DIR> Offline Web Pages 2023/11/08 00:44 <DIR> Panther 2022/05/07 13:24 <DIR> Performance 2025/07/29 18:57 571,468 PFRO.log 2022/05/07 13:42 <DIR> PLA 2023/12/13 13:28 <DIR> PolicyDefinitions 2025/07/30 00:06 <DIR> Prefetch 2024/12/29 23:52 <DIR> PrintDialog 2024/02/14 15:28 <DIR> Provisioning 2024/12/03 20:57 772,976 py.exe 2024/12/03 20:58 53,104 pyshellext.amd64.dll 2024/12/03 20:57 770,552 pyw.exe 2022/05/07 13:20 552,960 regedit.exe 2022/05/07 13:42 <DIR> Registration 2022/05/07 13:24 <DIR> rescache 2022/05/07 13:42 <DIR> Resources 2022/05/07 13:24 <DIR> SchCache 2022/05/07 13:42 <DIR> schemas 2022/05/07 13:42 <DIR> security 2022/06/03 08:31 <DIR> ServiceProfiles 2025/07/29 18:57 <DIR> ServiceState 2023/12/13 13:28 <DIR> servicing 2022/05/07 13:28 <DIR> Setup 2025/07/29 18:58 80,580 setupact.log 2025/07/19 19:17 0 setuperr.log 2024/02/14 15:28 <DIR> ShellComponents 2024/01/10 21:47 <DIR> ShellExperiences 2022/05/07 13:42 <DIR> SKB 2025/07/22 20:37 <DIR> SoftwareDistribution 2024/10/22 12:36 <DIR> SoftwareDistribution.old 2022/05/07 13:24 <DIR> Speech 2022/05/07 13:24 <DIR> Speech_OneCore 2023/11/15 14:32 192,512 splwow64.exe 2022/05/07 13:24 <DIR> System 2022/05/07 13:22 219 system.ini 2025/07/29 18:57 <DIR> System32 2023/11/01 18:31 <DIR> SystemApps 2024/02/14 15:28 <DIR> SystemResources 2025/07/30 00:07 <DIR> SystemTemp 2025/07/02 20:27 <DIR> SysWOW64 2022/05/07 13:24 <DIR> TAPI 2024/10/03 20:46 <DIR> Tasks 2025/07/29 22:59 5,697,152 tbus_1400072873 2025/07/29 10:34 466,784 tbus_1700009696 2025/07/30 00:00 <DIR> Temp 2023/11/01 17:33 <DIR> tracing 2023/11/01 17:33 <DIR> twain_32 2022/05/07 13:20 69,120 twain_32.dll 2024/05/05 14:22 <DIR> USR-VCOM 2024/02/14 15:28 <DIR> UUS 2022/05/07 13:24 <DIR> Vss 2022/05/07 13:24 <DIR> WaaS 2022/05/07 13:42 <DIR> Web 2022/05/07 13:22 92 win.ini 2022/05/07 13:20 12,288 winhlp32.exe 2024/10/22 12:20 <DIR> WinSxS 2022/05/07 18:27 316,640 WMSysPr9.prx 2022/05/07 04:16 28,672 write.exe 2023/11/01 18:31 <DIR> WUModels 2022/05/07 18:27 <DIR> zh-CN 30 个文件 17,314,198 字节 87 个目录 71,749,197,824 可用字节
07-31
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值