Frage

I installed apache,mysql, phpmyadmin in my ubuntu machine. I have a large database to store in mysql, so moved mysql from root to /mnt0 directory. But looks like mnt0's memory is not consumed at all rather root directory's memory is consumed. which means maybe moving mysql was not successful. Below is the memory usage of my machine (when I started root directory, it had 6.3G of memory available. After using the database for a while, the available memory in root is 5.1G & mnt0 looks the same, I mean no memory usage)

Filesystem      Size  Used Avail Use% Mounted on
/dev/xvda1      7.8G  2.4G  5.1G  32% /
none            4.0K     0  4.0K   0% /sys/fs/cgroup
udev            3.7G  8.0K  3.7G   1% /dev
tmpfs           752M  212K  752M   1% /run
none            5.0M     0  5.0M   0% /run/lock
none            3.7G     0  3.7G   0% /run/shm
none            100M     0  100M   0% /run/user
/dev/xvdb       414G  485M  392G   1% /mnt0

This is where I moved mysql to buntu@ip-xx-xxx-xxx-xxx:/mnt0$ ls -l drwx------ 2 root root 16384 Feb 6 00:17 lost+found drwx------ 8 mysql mysql 4096 Feb 21 19:37 mysql

I have changed this file /etc/apparmor.d/usr.sbin.mysql for new datadir. /mnt0$ cat /etc/apparmor.d/usr.sbin.mysqld

# vim:syntax=apparmor
# Last Modified: Tue Jun 19 17:37:30 2007
#include <tunables/global>

/usr/sbin/mysqld {
  #include <abstractions/base>
  #include <abstractions/nameservice>
  #include <abstractions/user-tmp>
  #include <abstractions/mysql>
  #include <abstractions/winbind>

  capability dac_override,
  capability sys_resource,
  capability setgid,
  capability setuid,

  network tcp,

  /etc/hosts.allow r,
  /etc/hosts.deny r,

  /etc/mysql/*.pem r,
  /etc/mysql/conf.d/ r,
  /etc/mysql/conf.d/* r,
  /etc/mysql/*.cnf r,
  /usr/lib/mysql/plugin/ r,
  /usr/lib/mysql/plugin/*.so* mr,
  /usr/sbin/mysqld mr,
  /usr/share/mysql/** r,
  /var/log/mysql.log rw,
  /var/log/mysql.err rw,

  /mnt0/mysql/ r,
  /mnt0/mysql/** rwk,

  /var/log/mysql/ r,
  /var/log/mysql/* rw,
  /var/run/mysqld/mysqld.pid rw,
  /var/run/mysqld/mysqld.sock w,
  /run/mysqld/mysqld.pid rw,
  /run/mysqld/mysqld.sock w,

  /sys/devices/system/cpu/ r,

  # Site-specific additions and overrides. See local/README for details.
  #include <local/usr.sbin.mysqld>
}

Edit: added du -kh of /mnt0 & ls -lha /mnt0/mysql

root@ip-xx-xxx-xxx-xxx:/mnt0# du -kh
204K    ./mysql-crapy/mysql/phpmyadmin
4.0K    ./mysql-crapy/mysql/test
212K    ./mysql-crapy/mysql/performance_schema
1.1M    ./mysql-crapy/mysql/mysql
30M ./mysql-crapy/mysql
30M ./mysql-crapy
16K ./lost+found
40K ./api.Kavitha.com
32K ./mysql/DB
224K    ./mysql/phpmyadmin
4.0K    ./mysql/test
212K    ./mysql/performance_schema
1.1M    ./mysql/mysql
20K ./mysql/KavithaDataBase
110M    ./mysql
96K ./CoreUtils/cli/fb
952K    ./CoreUtils/cli
44K ./CoreUtils/addrstd
43M ./CoreUtils/db
12K ./CoreUtils/etc-conf
16K ./CoreUtils/feeds
16K ./CoreUtils/api/
68K ./CoreUtils/api
104M    ./CoreUtils/dict
16K ./CoreUtils/core/sendgrid/sendgrid-php/Test/Mock
28K ./CoreUtils/core/sendgrid/sendgrid-php/Test/SendGrid
56K ./CoreUtils/core/sendgrid/sendgrid-php/Test
20K ./CoreUtils/core/sendgrid/sendgrid-php/lib/swift/classes/Swift/CharacterReader
8.0K    ./CoreUtils/core/sendgrid/sendgrid-php/lib/swift/classes/Swift/CharacterReaderFactory
20K ./CoreUtils/core/sendgrid/sendgrid-php/lib/
36K ./CoreUtils/core/sendgrid/sendgrid-php/lib/
12K ./CoreUtils/core/sendgrid/sendgrid-php/lib/
12K ./CoreUtils/core/sendgrid/sendgrid-php/lib/swift/classes/Swift/Plugins/Reporters
8.0K    ./CoreUtils/core/sendgrid/sendgrid-php/lib/swift/classes/Swift/Plugins/Decorator
12K ./CoreUtils/core/sendgrid/sendgrid-php/lib/swift/classes/Swift/Plugins/Loggers
12K ./CoreUtils/core/sendgrid/sendgrid-php/lib/swift/classes/Swift/Plugins/Pop
112K    ./CoreUtils/core/sendgrid/sendgrid-php/lib/swift/classes/Swift/Plugins
20K ./CoreUtils/core/sendgrid/sendgrid-php/lib/swift/classes/Swift/StreamFilters
20K ./CoreUtils/core/sendgrid/sendgrid-php/lib/swift/classes/Swift/CharacterStream
16K ./CoreUtils/core/sendgrid/sendgrid-php/lib/swift/classes/Swift/Transport/Esmtp/Auth
32K ./CoreUtils/core/sendgrid/sendgrid-php/lib/swift/classes/Swift/Transport/Esmtp
124K    ./CoreUtils/core/sendgrid/sendgrid-php/lib/swift/classes/Swift/Transport
52K ./CoreUtils/core/sendgrid/sendgrid-php/lib/swift/classes/Swift/Mime/Headers
12K ./CoreUtils/core/sendgrid/sendgrid-php/lib/swift/classes/Swift/Mime/HeaderEncoder
16K ./CoreUtils/core/sendgrid/sendgrid-php/lib/swift/classes/Swift/Mime/ContentEncoder
212K    ./CoreUtils/core/sendgrid/sendgrid-php/lib/swift/classes/Swift/Mime
68K ./CoreUtils/core/sendgrid/sendgrid-php/lib/swift/classes/Swift/Events
24K ./CoreUtils/core/sendgrid/sendgrid-php/lib/swift/classes/Swift/Encoder
844K    ./CoreUtils/core/sendgrid/sendgrid-php/lib/swift/classes/Swift
852K    ./CoreUtils/core/sendgrid/sendgrid-php/lib/swift/classes
20K ./CoreUtils/core/sendgrid/sendgrid-php/lib/swift/dependency_maps
896K    ./CoreUtils/core/sendgrid/sendgrid-php/lib/swift
900K    ./CoreUtils/core/sendgrid/sendgrid-php/lib
40K ./CoreUtils/core/sendgrid/sendgrid-php/SendGrid
1008K   ./CoreUtils/core/sendgrid/sendgrid-php
1016K   ./CoreUtils/core/sendgrid
1.6M    ./CoreUtils/core
20K ./CoreUtils/
149M    ./CoreUtils
316M    .



/mnt0# ls -lha /mnt0/mysql

total 109M

drwx------ 8 mysql mysql 4.0K Feb 21 20:31 .
drwxrwxrwx 7 root  root  4.0K Feb 21 20:19 ..
drwx------ 2 mysql mysql 4.0K Feb 12 00:22 Db
-rw-r--r-- 1 root  root     0 Feb 11 19:38 debian-5.5.flag
-rw-rw---- 1 mysql mysql  98M Feb 24 18:12 ibdata1
-rw-rw---- 1 mysql mysql 5.0M Feb 24 18:12 ib_logfile0
-rw-rw---- 1 mysql mysql 5.0M Feb 24 18:12 ib_logfile1
drwx------ 2 mysql root  4.0K Feb 11 19:39 mysql
-rw-rw---- 1 root  root     6 Feb 11 19:39 mysql_upgrade_info
drwx------ 2 mysql mysql 4.0K Feb 11 19:39 performance_schema
drwx------ 2 mysql mysql 4.0K Feb 11 19:45 phpmyadmin
drwx------ 2 mysql root  4.0K Feb 11 19:38 test
drwx------ 2 mysql mysql 4.0K Feb 12 20:39 KavithaDataBase

Keine korrekte Lösung

Andere Tipps

Are you expecting the database to be huge? This looks correct and normal, if the database isn't that big the 1.2GB of phantom used space on your other partition could be explained by some non-MySQL process.

This helpful bit of code I found should show your approximate database size:

SELECT table_schema "Data Base Name", sum( data_length + index_length ) / 1024 / 1024 "Data Base Size in MB"
FROM information_schema.TABLES GROUP BY table_schema ; 

I suggest running that from the SQL tab of phpMyAdmin and looking at the results. If you add them all together it should be approximately 110MB. That way you can approximately tell whether the data is actually in MySQL at this point.

You may be a victim of under-mounting. This is a pretty easy thing to test:

# make a temp directory to mount
mkdir /tmp/testmount
# bind-mount the root partition to a new location
mount --bind / /tmp/testmount
# change into that directory. 
# Note: as this is a bind-mount, /mnt0 will NOT be mounted. It SHOULD be empty.
cd /tmp/testmount/mnt0
# see if there are any files where /mnt0 is
du -ah

If you get any files under /tmp/testmount/mnt0, then mysql is somehow starting to access files before /mnt0 is actually mounted. Files are created in the right spot, just not on the right filesystem. If this is the case, delay mysql start until after /mnt0 is mounted.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top