Skip to content Skip सामग्री के लिए


How to setup slow query logging in MySQL सेटअप को कैसे धीमी MySQL में प्रवेश प्रश्न

लिनक्स

If you run or administer a production MySQL server it's quite likely that it sometimes runs a little slow, and can be a very time consuming effort to figure out why. यदि आप चलाने या उत्पादन MySQL सर्वर यह काफी संभावना है कि प्रशासन यह कभी कभी थोड़ा धीमा चलाता है, और एक बहुत समय लेने के प्रयास को क्यों समझ नहीं हो सकता. To be able to pinpoint the query that slows the DB down can be hard to track down. करने के लिए प्रश्न है कि DB धीमा होने के लिए नीचे ट्रैक मेहनत कर सकते हैं तुच्छ कर सकता है. MySQL has an option to help you out. MySQL एक तुम्हारी मदद करने का विकल्प है. It comes with an option to log slow queries. यह एक धीमी प्रश्नों के लिए लॉग इन करें विकल्प के साथ आता है. This way when you find your database server running slower than usual you can open this log file in a text editor and see what queries are running slow. इस तरह आप अपने डेटाबेस हमेशा की तरह आप एक पाठ संपादक में इस लॉग फ़ाइल को खोलने और क्या प्रश्नों धीमी गति से चल रहे हैं देख सकते हैं की तुलना में धीमी चल सर्वर जब लगता है. Let's look at how to set this up. चलो यह कैसे सेट को देखो.

First open your MySQL server's configuration file, my.cnf . पहले अपने MySQL सर्वर के विन्यास फाइल, my.cnf खोलो. On Linux this should be in the /etc directory. लिनक्स पर यह / etc निर्देशिका में होना चाहिए. Look to see if the parameter log-slow-queries has already been set. देखो देखो अगर पैरामीटर लॉगइन धीमी सवालों के पहले से ही स्थापित किया गया है. If not, then set it to something like this: यदि नहीं, तो कुछ के लिए यह इस तरह से सेट करें:

log-slow-queries = /var/log/mysql/mysql-slow.log लॉग-धीमी सवालों = / var / log / mysql / mysql-slow.log

You also need to set the length of time before a query is fit to be considered a slow query . तुम भी एक प्रश्न के पहले समय की लंबाई निर्धारित करने की आवश्यकता है फिट के लिए एक धीमी प्रश्न पर विचार किया जाएगा. On my server I have set it to 30 seconds, like this: मेरे सर्वर पर मैं इसे 30 सेकंड के लिए सेट है, तो इस तरह से:

long_query_time = 30 = 30 long_query_time

Restart your MySQL server, and then watch the mysql-slow.log file. आपके MySQL सर्वर पुनः आरंभ करें, और तब फ़ाइल mysql-slow.log देखो. Whenever a query takes longer to complete than 30 seconds, or whatever you set in my.cnf , the query will be logged in mysql-slow.log. जब भी एक प्रश्न के 30 सेकंड, पूरी तरह से लेता है या फिर जो भी तुम my.cnf में स्थापित, mysql क्वेरी में लॉग इन किया जाएगा slow.log. Now debugging MySQL queries should be a lot simpler and quicker for you. अब debugging MySQL प्रश्नों बहुत सरल और जल्दी आप के लिए होना चाहिए. Do remember to check this file every once in a while. इस जांच के लिए एक समय में हर एक बार फ़ाइल याद करो. What might help is to क्या मदद कर सकता है setup a cron job सेटअप एक क्रॉन जॉब to mail you this file once every few days. मेल को आप एक बार इस फ़ाइल हर कुछ दिनों के लिए.

Posted in पोस्ट में Linux लिनक्स . .

Related Posts: संबंधित पोस्ट:

How to monitor MySQL in real-time with mytop कैसे mytop के साथ वास्तविक समय में MySQL की निगरानी के लिए
How to remotely access your MySQL in a secure manner कैसे दूर एक सुरक्षित तरीके से आपके MySQL तक पहुँचने के लिए
Bash one liner – how to compress, move, and extract a directory पार्टी की योजना बनाई एक लाइनर - कैसे जमना, के लिए कदम है, और एक निर्देशिका निकालें
How to get a detailed MySQL status report कैसे एक विस्तृत रिपोर्ट MySQL दर्जा पाने के लिए
How to reset a lost MySQL root password कैसे एक खो MySQL रूट पासवर्ड रीसेट के लिए

0 Responses 0 प्रतिक्रियायें

Stay in touch with the conversation, subscribe to the बातचीत के साथ संपर्क में रहो, की सदस्यता लें RSS feed for comments on this post आरएसएस के इस पोस्ट पर टिप्पणियों के लिए फ़ीड . .



Some HTML is OK कुछ HTML है ठीक है

or, reply to this post via या, इस पोस्ट के माध्यम से जवाब trackback Trackback . .