Fixing mysqldump: Got error: 1016: Can’t open file & mysqldump: Got error: 23

When doing exports of large databases using mysqldump, it is common to get errors that are along the lines of:

mysqldump: Got error: 1016: Can’t open file: ‘./databasename/tablename.frm’ (errno: 24) when using LOCK TABLES

or maybe

mysqldump: Got error: 23: Out of resources when opening file ‘./databasename/tablename.MYD’ (Errcode: 24) when using LOCK TABLES

Both come from the same cause and don’t worry – your database is not currupt..

The first action that mysqldump takes is to lock all of the tables so that the database cannot go out of sync from the beginning to the end of the export.  Of course, that means that your users can’t make changes while  doing the dump. And that’s just one more reason you need to be careful using mysqldump.

The solution to this problem is simple add –skip-lock-tables to your command line.

At that point the tables won’t be locked, and the export will run much faster. There is a slight downside in that people can use the table as it is being exported and you could potentially get an update written as you are exporting that table. But it is unlikely that you’ll hit any real world problems when doing this, especially with things like blog exports.

Notty Notty! re:”All my Server CPU is used by root@notty!! Have I been hacked?”

First – Breathe.  “notty” stands for “no teletypewriter”. Programs that connect to the server but don’t want the output displayed any where use a “No TTY” connection. So if you see “ssh: *@notty” on a task list somewhere, it just means there’s an ssh login on your server does not have a visual interface assigned to it.

This can appear during many different relatively common server activities. So it is not the tag of some hacker as you might have feared. One of the most common examples is the use of the scp command. scp remotely copies files from one computer to another. When it connects to the remote computer, it isn’t displaying that communication to a screen, so the connection is a notty connection.

Below is a partial screen scrape of a “top -c” command when scp is running:

PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
32706 root      15   0 14284 7116 2336 S 68.1  0.3   6:15.37 sshd: root@notty
32709 root      18   0  6788 1468 1124 R  4.0  0.1   0:20.84 scp -r -f /home2

As you can see the cpu usage was pretty high and that’s what gets people worried. They are probably looking at “top” see how much longer it will take to finish copying files. Then they see that scp is taking up nothing while a task named “notty” is taking up huge amounts of CPU and they think someone is being “naughty”.  Now you know what is really happening.

So relax! It’s all good.

How to Add a TXT record to your 1and1 domain & How to use external DNS for a 1and1 hosted site.

Unfortunately there are lots of registrars that don’t allow you full access to your DNS settings.  1and1.com is one of these. If you host your site with 1and1.com and you want to add a TXT record to your domain for verification purposes or to set a SPF record whatever, you simply can’t do it… unless…

If you have access to another DNS server that allows you to edit your DNS zone and add TXT records, you can set your 1and1 domain to use that DNS server.  However, THEN you must edit the DNS zone on that server and have all of the A records point back to the IP address for you 1and1 account.

Here are the steps:

  1. Ping your site and write down the IP address
  2. Go to the 1and1 admin domain listing
  3. Select the row for your domain (should be the only one checked) and the click DNS->Edit DNS.
  4. Select My DNS Servers
  5. Enter the URLS for your other DNS server (Something like ns1.example.com and ns2.example.com
  6. Close and save and allow a few hours for this to update before testing it.
  7. In the mean time, go to your other DNS server and setup a new DNS zone for your domain.  It needs to have at LEAST an a record pointing to the IP address you wrote down for step one. You probably also want setup a cname for your www subdomain.  You also can setup your TXT record.
  8. After hitting save wait for a few hours and you should be done.

 

If you are a visual learner, here is a screen cast.