Posts Tagged 'Administrator'

November 11, 2011

UNIX Sysadmin Boot Camp: Passwords

It's been a while since our last UNIX Sysadmin Boot Camp ... Are you still with me? Have you kept up with your sysadmin exercises? Are you starting to get comfortable with SSH, bash and your logs? Good. Now I have an important message for you:

Your password isn't good enough.

Yeah, that's a pretty general statement, but it's shocking how many people are perfectly fine with a six- or eight-character password made up of lowercase letters. Your approach to server passwords should be twofold: Stick with it and Be organized.

Remembering a 21-character password like ^@#*!sgsDAtg5t#ghb%!^ may seem daunting, but you really don't have to remember it. For a server, secure passwords are just as vital as any other form of security. You need to get in the habit of documenting every username and password you use and what they apply to. For the sake of everything holy, keep that information in a safe place. Folding it up and shoving it in your socks is not advised (See: blisters).

Want to make your approach to password security even better? Change your passwords every few months, and make sure you and at least one other trusted colleague or friend knows where to find them. You're dealing with sensitive material, but you can never guarantee that you will be available to respond to a server-based emergency. In these cases, your friends and co-workers end up scrambling through bookshelves and computer files to find any trace of useful information.

Having been one of the abovementioned co-workers in this situation, I can attest that it is nearly impossible to convince customer service that you are indeed a representative of the company having no verification information or passwords to provide.

Coming soon: Now you've got some of the basics, what about the not-so-basics? I'll start drafting some slightly more advanced tips for the slightly more advanced administrator. If you have any topics you'd like us to cover, don't hesitate to let us know in a comment below.

-Ryan

June 8, 2011

MySQL Slow? Check for Fragmentation.

Let's say you have a website and you notice that any calls to your MySQL database take longer to render. If you don't have a Database Administrator (DBA), this can be pretty frustrating. SoftLayer's Managed Hosting line of business employs some of the best DBAs in the country and is one of the only managed hosting providers that offers MySQL and MsSQL DBA services, and I don't just say that because I'm one of them ... We've got the certifications to prove it. :-)

Given my area of expertise, I wanted to share a few some simple tips with you to help you tweak variables and improve the performance of your MySQL server. Given that every application is different, this isn't necessarily a one-size-fits-all solution, but it'll at least give you a starting point for troubleshooting.

First: Get mysqltuner.pl. This is a fine script by Major Hayden that will give you some valuable information regarding the performance of your MySQL server.

Second: Look for fragmented tables. What are fragmented tables? If there are random insertions into or deletions from the indexes of a table, the indexes may become fragmented. Fragmentation means that the physical ordering of the index pages on the disk is not close to the index ordering of the records on the pages or that there are many unused pages in the 64-page blocks that were allocated to the index. The symptoms of fragmented tables can be that table can take more disk space than needed or the results may return slower with more disk I/O than needed. INNODB users need to check the fragmentation often because when INNODB marks data as deleted, it never overwrites the blocks with new data ... It just marks them as unusable. As a result, the data size is artificially inflated and data retrieval is slowed.

Fortunately, there is a way to see your table fragmentation and that is to run a query against the information_schemea to show all tables that are fragmented and the percentage of fragmentation:

SELECT TABLE_SCHEMA, TABLE_NAME, CONCAT(ROUND(data_length / ( 1024 * 1024 ), 2), 'MB') DATA, CONCAT(ROUND(data_free  / ( 1024 * 1024 ), 2), 'MB')FREE from information_schema.TABLES where TABLE_SCHEMA NOT IN ('information_schema','mysql') and Data_free < 0;

Fixing the fragmentation is easy, but there are a few caveats. When defragmenting a table, it will lock the table, so make sure you can afford the lock. To fix fragmented tables, you can simply run optimize table <table name>; to rebuild the table and all indexes or you can change the engine of the table with alter table <table name> engine = INNODB;

I have written a simple bash script in bash to go through, defragment and optimize your tables:

#!/bin/bash
 
MYSQL_LOGIN='-u<user name> --password=<passowrd>'
 
for db in $(echo "SHOW DATABASES;" | mysql $MYSQL_LOGIN | grep -v -e "Database" -e "information_schema")
do
        TABLES=$(echo "USE $db; SHOW TABLES;" | mysql $MYSQL_LOGIN |  grep -v Tables_in_)
        echo "Switching to database $db"
        for table in $TABLES
        do
                echo -n " * Optimizing table $table ... "
                echo "USE $db; OPTIMIZE TABLE $table" | mysql $MYSQL_LOGIN >/dev/null
                echo "done."
        done
done

You'd be surprised how much of an impact table fragmentation has on MySQL performance, and this is an easy way to quickly troubleshoot your database that "isn't as fast as it used to be." If you follow the above steps and still can't make sense of what's causing your database to lag, our Managed Hosting team is always here to work with you to get your servers back in shape ... And with the flexibility of month-to-month contract terms and the ability to add managed capabilities to specific pieces of your infrastructure, we have to earn your business every month with spectacular service.

-Lee

June 24, 2008

A Little Philosophical Thought: The SoftLayer Family Tree

Somewhat picking up on the theme of the blog, “Here’s to you, that nerdy Sysadmin”, this is a sort of, “Here’s to you, our family tree of customers.”

I find it very interesting how everyone in the world has customers. Our customer’s, customer’s, customer’s, customer’s…and so on…depend on us here at SoftLayer. It is a sort of bottomless pit. Does it begin anywhere…or end anywhere. Does anyone NOT have customers?

For example:

Our customers have customers, who have customers, who have customer, who have customers, etc. We are the customer of INTEL, AMD, Seagate, etc. They are the customers of those that provide the material to make the hardware that they manufacture. The natural resources used to make the hardware are purchased from someone. That someone purchased the rights to those resources from someone, who purchased the rights from someone, who purchased the rights from someone, etc. I suppose somewhere upstream someone’s country went to war and took the rights to those resources from someone else. And, I suppose if you go far enough back, no one had “rights” to those resources before the land was “claimed”. As recent as 2005, the race was on to claim the land of the Arctic Circle. I suppose you could say that all customers began with a gift of land containing resources from God. And, SoftLayer gives free stuff to customers all the time…so…I guess God gave the land containing the resources to people…His customers!

Anyway, this necessity of life that we have termed “customers”, has been, and will always be, I suppose, the most important aspect of life in terms of survival. Without customers, basic necessities like food cannot be purchased. In other words, without customers, you cannot be a customer. And, if you are not a customer, you must, therefore, be dead. So, in terms on everyone being dependent on being a customer and having customers, we all depend on each other like a family of customers. And, we must take care of our family.

We know that our survival, here at SoftLayer, depends on our customers (our family) and that their survival depends on us. We take this responsibility very seriously and work very hard to provide for our family the way that we would like to be provided for.

In conclusion, I feel that we, here at SoftLayer, do a pretty good job of taking care of our “family”, and in turn, our family of customers do a great job of taking care of us. As we continue to grow together, our success will benefit each other for years and years to come.

*If you do not understand any of this, just write it off to the insane ramblings of a tired CSA at the end of a long, challenging, and yet satisfying day at Softlayer working for his family.

-David

Categories: 
Subscribe to administrator