Home |  MySQL Buzz |  FAQ |  Feeds |  Submit your blog feed |  Feedback |  Archive |  Aggregate feed RSS 2.0 English Deutsch Español Français Italiano 日本語 Русский Português 中文
Showing entries 1 to 30 of 30

Displaying posts with tag: System admin (reset)

PHP: Curl being slow from php call on CentOS 5.4
+0 Vote Up -0Vote Down

I ran into an issue where curl request run within few ms from command line but same url fetch was taking over 10 secs. After doing some debugging and research it turned out that call to check (getaddr ipv6 was timing out. Obviously you can do multiple things to fix this (including enabling ipv6 support) but since I did not have a need for ipv6 (it is disabled in my network configuration), I decided to recompile curl and disable ipv6. Here is the command for recompiling curl and installing into /usr/local/curl directory with ipv6 disabled.

./configure –prefix=/usr/local/curl –disable-ipv6

————————————-
DISCLAIMER: Please be smart and use code found on internet carefully. Make backups often. And yeah.. last but not least.. I am not responsible for any damage caused by this

  [Read more...]
SVN: How do you use svn command line on Windows with ssh tunneling?
+0 Vote Up -0Vote Down

If you ever used svn command line, you know it is not optimal to type in your password every time you do checkout, checkin, info, etc.  In linux world, it is very easy to setup keys to get around this.  Of course in the world of Windows it is not as easy.  Here are the steps you need to follow to get private/public keys working with your SVN under Windows using ssh tunneling.

Assumptions:  you will be connecting as user “root” to svn server located at “10.0.0.1″.  All your files will be saved at c:\ including your svn command line utility

First we will have to generate a key.  We can accomplish this by using a free utility called

  [Read more...]
sshfs: How do you install sshfs and fuse? [CentOS/Linux/Redhat]
+0 Vote Up -0Vote Down

One may wonder what is sshfs and why would you want it?  Well simply put, sshfs allows you to mount another server’s filesystem into a folder on your local system which in the background is doing ssh commands and transfers.  As a mounted folder, you are able to move about and copy files back and forth as everything was on local server.  As you can see this makes it very easy for you to work with files on multiple servers.

Note:  you only have to do the following installations on the server where you are doing the mounts on.

Let us download and install the filesystem framework which is a requirement for sshfs called fuse.

wget http://voxel.dl.sourceforge.net/sourceforge/fuse/fuse-2.7.4.tar.gz
tar zxpfv fuse-*.gz
cd fuse*
./configure

If you get the following error, you will either have to point to the




  [Read more...]
Linux: How do you find out what your server’s outgoing ip is?
+0 Vote Up -0Vote Down

There are many times when I needed to find out my outgoing (or external) IP for the servers which are behind load balancers or firewalls.  I used to just login to another external server from the server in question and find out by looking at “who” what my external ip is.  Even though it works and I am so used to it, today I decided to figure out a more graceful way of finding my outgoing ip.  As most of us already know, whatismyip.com is the quickest way to find out your outgoing ip from the browser.  So I decided to use the same way on the servers.  So I issued a wget:

wget http://www.whatismyip.org

Well that does the trick.  But being lazy as I am, I did not want to have to cat the output file to find out the ip (plus there is no point of creating extra files and

  [Read more...]
Apache/http monitoring: monitor http traffic in realtime using httptop
+0 Vote Up -0Vote Down

Server monitoring is a big part of running a solid web site.  As an admin, you must know what is going on your server.  One of the tools most Linux/Unix admins are used to is called “top”.  “top” by itself is a very powerful tool.  Here is a quick guide on how to read output from top:  introduction to load averages under top.  It just makes sense that somebody went and created httptop to monitor http traffic.

Install perl modules:

install Term::ReadKey
install File::Tail
install Time::HiRes

Now copy paste the script below and save it in a location and set +x attribute on it so you



  [Read more...]
MySQL: How do you enable sphinxse (Sphinx Storage Engine) in your mysql installation?
+0 Vote Up -0Vote Down

As you may know mysql fulltext search is not highly scalable.  One of the options to get around this scalability limitation, which I prefer, is to use Sphinx.  You can use Sphinx with out having to alter your mysql installation.  But, if you would like to use from within mysql and not have to worry about how to pass data between Sphinx and MySQL, you can enable sphinxse (sphinx storage engine).  It is not included with mysql by default so you will have to compile it yourself.

Here are the instructions on how to get sphinxse compiled with your mysql installation on CentOS x64.  I am sure same instructions will work for other flavors but I have not tested it.  I will be compiling the most current version of sphinx (0.9.8) with most current stable version of mysql (5.0.51b) at the time of the writing. 

  [Read more...]
Linux: yum options you may not know exist.
+0 Vote Up -0Vote Down

Most of the users who work with distributions such as: centos, fedora, redhat, etc use yum as a package update/installer. Most of them know how to do “yum update [packagename]” (to update all or [certain packages]) or they do “yum install packagename” to install certain package(s). But yum can do so much more. Here are some options you may find useful:

Following command will search for the string you specified. Generally this will give you all of the packages which has specified string in title or description. Most of the time you will have to look through a lot of output to find what you are looking for.

yum search string

Probably one of the most important options for yum is provides/whatprovides. If you know what command you need, you can find out what package you have to install in order to have that command available to

  [Read more...]
Apache2 gzip compression: How do I speed up my website download time?
+0 Vote Up -0Vote Down

One of the things people tend to forget is the ability for web servers to compress content before sending it back to client. Client’s browser then uncompresses the data and displays it to the user. Pretty much all of the recent browsers support gzip compression. In this post, I will go over how to setup apache2 to use compression. First let’s see if your Apache installation has “deflate” enabled. You can check to see if you have deflate by typing:

# /usr/local/apache2/bin/apachectl -t -D DUMP_MODULES
Loaded Modules:
...
deflate_module (static)
...
Syntax OK

If you don’t have have deflate_module, you would have to recompile your apache with “–enable-deflate” option.

Going forward, I am going to assume you have deflate_module. Add the following to your apache conf file:






  [Read more...]
Linux: How do you rename a user account in linux?
+0 Vote Up -0Vote Down

In Linux, there is no command which will rename a user account. If you make a mistake creating a user account, user changes their name or if user does not like his user name, there is no real easy way of going and making the change. Only thing I know you can do is to go through some files and rename user manually. Let us say that we have a user who is named joe and we want to rename him to john.

Note: you must be logged in as root to do following.

vi /etc/passwd
find joe and change it to john, save/exit

vi /etc/group
find joe and change it to john, save/exit

vi /etc/shadow
find joe and change it to john. This file is read only and you have to force overwrite it. In vi it is :w! once saved, quit.

cd /home
mv joe john

And that should do the trick.

[Edited] Right after I posted this post, I was





  [Read more...]
MySQL: How do you set up master-master replication in MySQL? (CentOS, RHEL, Fedora)
+0 Vote Up -0Vote Down
Setting up master-master replication in MySQL is very similar to how we set up master/slave replication. You can read up about how to setup master/slave replication in my previous post: How to set up master/slave replication in MySQL. There is obviously pros and cons about using master/master replication. But this is not [...]   [Read more...]
MySQL: How do you set up master-slave replication in MySQL? (CentOS, RHEL, Fedora)
+0 Vote Up -0Vote Down
Before we go into how to set up master-slave replication in MySQL, let us talk about some of the reasons I have set up master-slave replication using MySQL. 1) Offload some of the queries from one server to another and spread the load: One of the biggest advantages to have master-slave set [...]   [Read more...]
PHP: How do I install phpsh, interactive shell prompt for php under CentOS or Fedora?
+0 Vote Up -0Vote Down
phpsh requires readline support built into python. It also requires python version 2.4+. You can check which version of python you have installed by typing: python -V Let us download and install readline: wget ftp://ftp.cwru.edu/pub/bash/readline-5.2.tar.gz tar zxf readline-5.2.tar.gz cd readline-5.2 ./configure make install Now let us install python with readline support: wget http://www.python.org/ftp/python/2.5.1/Python-2.5.1.tgz tar zxf Python-2.5.1.tgz cd Python-2.5.1 I had some problems on one of the [...]   [Read more...]
MySQL: How do I import individual table dump files in to MySQL using shell script?
+0 Vote Up -0Vote Down
After I wrote the post: How do I dump all tables in a database into separate files? I got emails from couple people asking how to import the individual table files back in to MySQL. First way to import each sql file created by the post is to import each file individually by [...]   [Read more...]
MySQL: How do I dump all tables in a database into separate files?
+0 Vote Up -0Vote Down
There have been numerous occasions where I needed to make backups of individual tables from selected database. Usually I can achieve this by typing: mysqldump database_name table1 > table1.sql mysqldump database_name table2 > table2.sql This could be very painful if you have 10?s or 100?s of tables. Until today, I never ran into a situation where I [...]   [Read more...]
MySQL Cluster: Changing datamemory requires node restart with ?initial?
+0 Vote Up -0Vote Down
I ran into something with mysql cluster today which boggles my mind.  On http://dev.mysql.com/doc/refman/5.0/en/mysql-cluster-config-params-ndbd.html page, it is documented that if we you change datamemory parameter in the config.ini under mysql-cluster like below, you would have to restart nodes to reread the configuration. [NDBD] id=2 HostName=10.0.0.2   # the IP of the first data node DataMemory=6G IndexMemory=512M But when I tried the: [...]   [Read more...]
MySQL: Slave lag behind master and data corruption.
+0 Vote Up -0Vote Down
I am reaching out to mysql experts out there! We just inherited a site which uses MySQL master/slave replication. We set up the master and slaves per MySQL documents and did some of our own tweaking in my.cnf to get things working. Things were great when we were testing the site but [...]   [Read more...]
MySQL: How do I reset MySQL to have only the databases when I first installed it? (CentOS, Redhat, Fedora, Linux)
+0 Vote Up -0Vote Down
One of my clients asked me today to make their MySQL installation go back to default database install. Basically they wanted me to get rid of all their databases (in this case test databases) so they can start fresh and go live with only the databases they needed. So here are the steps [...]   [Read more...]
MySQL: InnoDB: ERROR: the age of the last checkpoint is [number]
+0 Vote Up -0Vote Down
One of the mysql database servers I manage started to have issues with doing backups yesterday. mysqldump was running but nothing was happening on the backup side. I started to investigate to see why our full backups were failing. I opened up the mysql error log file (mine is at: /usr/local/mysql/var/hostname.err) [...]   [Read more...]
MySQL: Changing runtime variables with out restarting MySQL server.
+0 Vote Up -0Vote Down
I have run in to the issue where I wanted to change some configuration on our production MySQL server but did not want to restart MySQL since its in production.  One of the parameters we like to change time to time is the “log_slow_queries” so we can see what queries are slow in production environment.  [...]   [Read more...]
MySQL: ibdata files do not shrink on database deletion [innodb]
+0 Vote Up -0Vote Down
One very interesting thing I noticed with MySQL was that if you delete a database, ibdata file doesn’t shrink by that much space to minimize disk usage. I deleted the database and checked usage of /usr/local/mysql/var folder and noticed that ibdata file is still the same size. So the problem I face now [...]
MySQL database backup file compression: gzip vs bzip2
+0 Vote Up -0Vote Down
In one of my previous posts: MySQL backups, I talked about using a script for automating backups. I show that we can use gzip to compress backup file to compress and save. Since then, our backup file has been growing meg or two a day which is causing our backup files to get [...]
Linux time - Daylight saving time (DST)
+0 Vote Up -0Vote Down

Its that time of the year again when time changes and we have to make sure our servers are using the right zone with right time. Out of many servers I admin, I found 3 servers which had wrong time displaying. All of them had one thing in common, Fedora Core 4. So I fixed it by doing the folowing.

mv /etc/localtime /etc/localtime.old

ln -s /usr/share/zoneinfo/PST8PDT /etc/localtime

MySQL wait_timeout setting
+0 Vote Up -0Vote Down
We were having issues with mysql threads where they would be in sleep mode and wouldn’t die off for long time. At the same time we started having issues with our servers where the load will spike and eventually server will come to halt unless we killed all the apache processes and restarted apache [...]
Windows Vista Ultimate installation (update 2)
+0 Vote Up -0Vote Down

Now since I reinstalled Vista 32bit version and its up and running, lets go through what works what don’t.

  • Daemon Tools (check)
  • Microsoft Office (check)
  • Trillian (check)
  • VMWare Server (CHECK!)
  • Diskeeper 10 (Nope, apparently I have to go download an update for Vista, postponed)
  • Ok now the fun part starts. How to get everything working the way I want to.

    I need to start my Fedora virtual machine so I can get some development/testing done. And a wall I hit. It says that I don’t have permissions to open the file. I am logged in as a user which belongs to Administrators group. So why do I not have permission? Well let me copy it to desktop and see if that works. Voila! it does! Ok.. I will let this one go since I have already wasted my whole weekend getting Vista going.

    OK.. so lets

      [Read more...]
    Windows Vista Ultimate installation (update 1)
    +0 Vote Up -0Vote Down

    While looking through my new Vista, I found out that my cpu is 64bit capable! I was like.. OMFG hell yeah! I whipped out the 64bit Vista DVD and nuked all my hard work of setting up software without even giving it a second thought… About 20 mins later, I was back in my new found love, except this time I dove right into installing software. One by one, I get basic stuff installed in following order:

  • daemon tools (went out and got the upgraded vista version) no problems
  • Microsoft Office 2007 ultimate, uh.. thank god no problems there
  • McAfee VirusScan, ofcourse problems.. knew that from 32 bit version but what the hell.. was worth a try
  • Trillian - another no problem
  • VMWare Server………………………………………….PROBLEMS! Sigh.. they don’t support
  •   [Read more...]
    Windows Vista Ultimate installation
    +0 Vote Up -0Vote Down

    There I was sitting and working and minding my own business when I heard bunch of noise outside of my office. So I took my headphones off to tune in to the conversation. One of the developers has gone out and bought Windows Vista Ultimate edition and was talking about installing it and trying it out. I have always tried out all of the Windows flavors since 3.1 as soon as they came out and even did beta runs for NT 4, XP, 2000, 2003 and even Vista. But for some reason after installing and running beta 2 of Windows Vista, I wasn’t very impressed. But when they were talking about installing Vista, I myself got curious to find out how good/bad is the released version. So I went and got myself a copy of Vista Ultimate as well.

    I didn’t want to destroy my laptop so I decided to install it on my old computer. The specs of that computer are:

    Intel Pentium 3.2 with

      [Read more...]
    What is this ?load average? I keep hearing about?
    +0 Vote Up -0Vote Down

    I have been asked numerous times what does “load average” means in top. If you don’t know what top is and you have access to linux machine, go type top now and see what it shows.

    load average: 2.05, 2.17, 1.93

    Quick answer is: first number (2.05) is 1 minute avg, second number (2.17) is 5 minute avg, third number (1.93) is 15 min avg. Generally system admins look at these #’s to see how is their server is doing. But now you wonder, if this is the #’s you look at, why is there cpu %? Isn’t that computer load also? Ofcourse it is. BUT, meaning of cpu % shown in [ Cpu(s): 14.2% us, 1.7% sy, 0.0% ni, 80.7% id, 3.1% wa, 0.0% hi, 0.3% si, 0.0% st ] actually just means how much % of time was spent doing stuff on cpu. On the other hand, load average takes other things such as how much cpu’s were

      [Read more...]
    MySQL backups using mysqldump
    +0 Vote Up -0Vote Down
    MySQL backups are essential to running a site with MySQL backend. Generally you can get away with doing nightly backups but on our site, due to couple issues we had in past, we are forced to do hourly backups of our db. Intially I was doing backup by using: mysqldump dbname > weekdayHour.dbname.sql hourly. [...]
    Improve page load time and increase server capacity by doing simple DNS and server changes
    +0 Vote Up -0Vote Down

    Problem:

    One of the sites I maintain has been getting more and more traffic everyday. A very good thing for the site, not so good for the solo server which is serving those pages. The site is VERY dynamic with LAMP setup. We only have one server serving our web pages to our users. Since its a dynamic site with PHP and MySQL, it has a lot of load during peak times. Average load time of a page is between 1-2 secs during normal usage, 2-5 secs under average to heavy load.

    During heavy load, we started to see our mysql stop responding to requests which is a big concern for us since we don’t show content if there is no db connection. We had to come with a solution, fast, to prevent this issue from appearing.

    Solution:

    So here are couple things I ended up

      [Read more...]
    Google mini blues - 406 ownage!
    +0 Vote Up -0Vote Down

    We used to use Google mini to index our site to serve search results to our users. It worked great for a while until sometime back it just stopped indexing. It would get a fatal error and stop index after couple urls. It was also not so kind about sending me an email to let me know that it has stopped indexing. It was still serving pages which were indexed prior to this so we didn?t realize it wasn?t indexing new content.

    And than one day we logged in to the admin console to see whats going on with it and found out it wasn?t indexing. I checked the logs and found out that it was stopping due too too many 4xx errors. After looking at logs on our web server I found out that it was stopping because Apache was giving back 406 response code which is described at w3.org as:

    The resource identified by the request is only capable of generating response entities

      [Read more...]
    Showing entries 1 to 30 of 30

    Planet MySQL © 1995, 2014, Oracle Corporation and/or its affiliates   Legal Policies | Your Privacy Rights | Terms of Use

    Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.