Reducing memory consumption of mysql on ubuntu@aws micro instance

前端 未结 4 763
-上瘾入骨i
-上瘾入骨i 2021-01-30 03:13

I have recently started on a PoC project wherein we are developing a small web app. The initial setup is done on a micro instance from AWS. We are on rails+mysql stack.

4条回答
  •  旧时难觅i
    2021-01-30 03:54

    Just to add to the other answer. I recently had this problem myself with the Amazon micro instance (not Ubuntu). The my.cnf file is almost empty so what I did was this:

    cp /etc/my.cnf /etc/my.cnf.orig
    cp /usr/share/mysql/my-medium.cnf /etc/my.cnf
    

    Edit my.cnf and enable the innodb lines if applicable. Restart mysqld.

    Also the micro instance has no swap, that might be a problem..

    SWAPFILE=/mnt/swapfile.swap
    dd if=/dev/zero of=$SWAPFILE bs=1M count=512
    mkswap $SWAPFILE
    swapon $SWAPFILE
    

    Then in /etc/rc.local add:

    swapon /mnt/swapfile.swap

    To save memory in ruby you might want to use ruby enterprise:

    bash < <(curl -s https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer)
    gpasswd -a root rvm
    source /etc/profile.d/rvm.sh
    rvm get head
    rvm reload
    rvm install ree
    rvm --default use ree
    

提交回复
热议问题