For my openHAB system I installed InfluxDB (on a separate) Raspberry Pi. The Pi has a 32 GB SDcard, but that is not enough for storing all the data, and that Pi has additional work to do as well. For that reason I also attached a 1 TB disk to the Pi, and mounted it on /data. Now all I have to do is move the InfluxDB data directory to /data.
Continue reading "Move InfluxDB data directory to a SDcard"
Ever tried to rename a database in MySQL? Obviously not.
Why not? MySQL does not support renaming databases. Funny, eh?
They once tried to implement this feature but failed and removed the code again. Note the sudden major feature shifts in minor releases.
So, how to rename a database? Dump the database, create a new database and import the dump. Both steps can be executed together:
mysqldump old_database | mysql new_database
A website shows the following error message:
SQLSTATE[HY000]: General error: 126 Incorrect key file for table '/tmp/#sql_1898_0.MYI'; try to repair it
So, MySQL: which table is to repair? The error message is not a table, it's just the temp file.
Stupid and useless error message ...
Happened on IRC, just minutes ago:
22:35:09 -!- michi7x7 has joined #postgresql
22:35:14 < michi7x7> hi all
22:35:44 < michi7x7> i have a problem with a mysql-query, but #mysql is full of mysql-lover-noobs
Users start asking the PostgreSQL-guys for MySQL-support. Times are changing ;-)
If you run MySQL and this error occurs:
SQLSTATE[HY000]: General error: 3 Error writing file '/tmp/MYh0VgDS' (Errcode: 28)
then check if your server isn't using the famous "overflow" filesystem for /tmp, limited to 1 MB space.
The MySQL error message is - as usual - misleading and non-descriptive.
There are many other possible causes for this error code, so this one here might just be a hint.
After issuing a REPAIR TABLE:
mysql> repair table search_archive_count_checked;
+----------------------------------+--------+----------+----------------------------------------------+
| Table | Op | Msg_type | Msg_text |
+----------------------------------+--------+----------+----------------------------------------------+
| xxx.search_archive_count_checked | repair | warning | Number of rows changed from 335540 to 365874 |
| xxx.search_archive_count_checked | repair | status | OK |
+----------------------------------+--------+----------+----------------------------------------------+
2 rows in set (36.75 sec)
I'm surprised: this is the first database which is able to create rows out of nothing. Violation of the conversation of energy data, eh? ;-)
Last year, tweakers.net did some performance tests with MySQL and PostgreSQL and they found out that MySQL did not scale very well with many concurrent connections.
Now Kris Kennaway did some tests on his own and posted the results to the FreeBSD performance list. The resulting graphs look very similar.
Got a nice problem: a table, which has the following primary key: id, id.
You can use or dump this table without problems ... but you cannot reinsert the dump into the same (4.1) or a newer (5.0) mysql version.
This is the table dump, created with "SHOW CREATE TABLE tablename":
----- cut -----
CREATE TABLE tablename (
id int(11) NOT NULL auto_increment,
title_en text,
...
PRIMARY KEY (id,id)
) TYPE=MyISAM DEFAULT CHARSET=latin1;
----- cut -----
Now i try to reinsert this table into another database:
----- cut -----
mysql> CREATE TABLE tablename (
-> id int(11) NOT NULL auto_increment,
-> title_en text,
...
-> PRIMARY KEY (id,id)
-> ) TYPE=MyISAM DEFAULT CHARSET=latin1;
ERROR 1060 (42S21): Duplicate column name 'id'
----- cut -----
What the ...
Should i repeat myself?
Too pity, this news is only an april fool:
Imagine, which problems could be solved in an instance ...
Today I woke up because the Nagios used by our isp sent me a sms: something does not work well on one of the association servers. According to the sms, the webserver was not responding. Ok, the webserver is never the cause of the problem, something else is going wrong.
Logged in over ssh, at least this works well. ps told me that the nightly database backup is hanging around, a script which fills some tables is also waiting. Mysql shell does not really work. Disc space? Ok, enough free space.
Shutting down webserver and database, killed all scripts hanging around and restarted the db. After a while, I got an error mail:
xxxxxxx.xxxxxx_gaestebuch
warning : Table is marked as crashed and last repair failed
warning : Size of indexfile is: 281307136 Should be: 267612160
error : Found 5174283 keys of 5174282
error : Corrupt
Nice ...
Ok, Let's repair the beast. myisamchk seems to work his way through the table, until I got this message:
myisamchk: warning: 301 records have been removed
So this wannabe database just deleted 301 datasets for whatever reason. Nice to see how data integrity is not handled at all.
I'm happy at all that the new platform is coming around, betatest just started yesterday. It's time to kick Mysql in the ass and use a real database.