I want to order by Time,but seems no way to do that ?
mysql> show processlist;
+--------+-------------+--------------------+------+---------+--------+----------------------------------+------------------------------------------------------------------------------------------------------+
| Id | User | Host | db | Command | Time | State | Info |
+--------+-------------+--------------------+------+---------+--------+----------------------------------+------------------------------------------------------------------------------------------------------+
| 1 | system user | | NULL | Connect | 226953 | Waiting for master to send event | NULL |
| 2 | system user | | v3 | Connect | 35042 | Locked | update postings a
left join cities b on b.id=a.job_city_id
left join states h on h.id=b.stat |
| 313888 | irnadmin | 172.19.0.239:40136 | v3 | Sleep | 0 | | NULL |
| 314075 | irnadmin | 172.19.0.239:41113 | v3 | Sleep | 0 | | NULL |
| 314118 | irnadmin | 172.19.0.239:41282 | v3 | Query | 34978 | freeing items | SELECT id, screen_name, type, active, bound, LastLogin, robotno, protocol FROM accounts WHERE email_ |
| 314686 | irnadmin | 172.19.0.239:43251 | v3 | Sleep | 0 | | NULL |
| 314732 | irnadmin | 172.19.0.239:43436 | v3 | Query | 34978 | freeing items | SELECT id, screen_name, type, active, bound, LastLogin, robotno, protocol FROM accounts WHERE email_ |
| 314984 | irnadmin | 172.19.0.239:44366 | v3 | Sleep | 2 | | NULL |
| 315051 | irnadmin | 172.19.0.239:44713 | v3 | Query | 0 | NULL | NULL |
| 315198 | irnadmin | 172.19.0.239:51569 | v3 | Sleep | 2 | | NULL |
| 315280 | irnadmin | 172.19.0.239:51849 | v3 | Query | 34978 | freeing items | SELECT id, email_address, type, closed, robotno FROM accounts WHERE screen_name = 'ShantanuS' |
| 315320 | irnadmin | 172.19.0.239:52045 | v3 | Query | 34978 | freeing items | SELECT id, screen_name, type, active, bound, LastLogin, robotno, protocol FROM accounts WHERE email_ |
| 315384 | irnadmin | 172.19.0.239:52463 | v3 | Sleep | 1 | | NULL |
| 452248 | irnadmin | 172.19.0.28:54899 | v3 | Query | 34978 | freeing items | SELECT id, email_address, type, closed, robotno FROM accounts WHERE screen_name = 'LIZW0218' |
| 452291 | irnadmin | 172.19.0.28:55045 | v3 | Sleep | 1 | | NULL |
| 452316 | irnadmin | 172.19.0.28:55144 | v3 | Sleep | 0 | | NULL |
| 452353 | irnadmin | 172.19.0.28:55278 | v3 | Sleep | 0 | | NULL |
| 452382 | irnadmin | 172.19.0.28:55371 | v3 | Query | 34978 | freeing items | SELECT o.account_id FROM online o JOIN accounts a ON a.id=o.account_id WHERE o.server_id IS NULL AND |
| 452413 | irnadmin | 172.19.0.28:55479 | v3 | Sleep | 1 | | NULL |
| 452541 | irnadmin | 172.19.0.28:55946 | v3 | Query | 34978 | freeing items | SELECT o.account_id FROM online o JOIN accounts a ON a.id=o.account_id WHERE o.server_id IS NULL AND |
| 452626 | irnadmin | 172.19.0.28:56215 | v3 | Sleep | 2 | | NULL |
| 452711 | irnadmin | 172.19.0.28:39916 | v3 | Sleep | 0 | | NULL |
| 452781 | irnadmin | 172.19.0.28:40161 | v3 | Sleep | 1 | | NULL |
| 452904 | irnadmin | 172.19.0.28:40955 | v3 | Query | 34978 | freeing items | select a.id, aa.screen_name, i.requester from interview_requests i left join accounts aa on aa.id=i. |
| 453014 | irnadmin | 172.19.0.28:41291 | v3 | Query | 34978 | freeing items | SELECT o.account_id FROM online o JOIN accounts a ON a.id=o.account_id WHERE o.server_id IS NULL AND |
| 453057 | irnadmin | 172.19.0.28:41377 | v3 | Query | 34978 | freeing items | select a.id, aa.screen_name, i.requester from interview_requests i left join accounts aa on aa.id=i. |
| 453084 | irnadmin | 172.19.0.28:41441 | v3 | Sleep | 0 | | NULL |
| 453112 | irnadmin | 172.19.0.28:41536 | v3 | Sleep | 0 | | NULL |
| 453156 | irnadmin | 172.19.0.28:41653 | v3 | Query | 34978 | freeing items | SELECT protocol FROM accounts WHERE email_address= '***#gtalk.jabber.jobirn.c |
| 453214 | irnadmin | 172.19.0.28:41800 | v3 | Sleep | 5 | | NULL |
| 453243 | irnadmin | 172.19.0.28:41991 | v3 | Sleep | 0 | | NULL |
| 453313 | irnadmin | 172.19.0.28:42255 | v3 | Query | 34978 | freeing items | SELECT o.account_id FROM online o JOIN accounts a ON a.id=o.account_id WHERE o.server_id IS NULL AND |
| 453396 | irnadmin | 172.19.0.28:53718 | v3 | Sleep | 2 | | NULL |
| 453476 | irnadmin | 172.19.0.28:54019 | v3 | Sleep | 0 | | NULL |
| 453561 | irnadmin | 172.19.0.28:54352 | v3 | Sleep | 3 | | NULL |
| 453594 | irnadmin | 172.19.0.28:54456 | v3 | Sleep | 0 | | NULL |
| 453727 | irnadmin | 172.19.0.28:55166 | v3 | Query | 34978 | freeing items | SELECT id, screen_name, type, active, bound, LastLogin, robotno, protocol FROM accounts WHERE email_ |
| 453786 | irnadmin | 172.19.0.28:55320 | v3 | Sleep | 4 | | NULL |
| 610140 | irnadmin | 172.19.0.28:33848 | v3 | Query | 34978 | freeing items | select a.id, aa.screen_name, i.requester from interview_requests i left join accounts aa on aa.id=i. |
| 685119 | irnadmin | 172.19.0.27:37251 | v3 | Query | 34980 | Sending data | select postings.id id,category, job_desc_title,
IF(c1.name is not null,c1.name,IF(c2.name is not n |
| 685226 | irnadmin | 172.19.0.139:57274 | v3 | Query | 34735 | Locked | SELECT job_desc_title,job_desc,job_state_name,job_city_name,company_categories.name,postings.categor |
| 685229 | irnadmin | 172.19.0.139:57278 | v3 | Query | 34735 | Locked | SELECT job_desc_title,job_desc,job_state_name,job_city_name,company_categories.name,postings.categor |
| 685232 | irnadmin | 172.19.0.139:57283 | v3 | Query | 34734 | Locked | select job_desc_title,job_desc from postings where id=287650 |
| 685233 | irnadmin | 172.19.0.139:57286 | v3 | Query | 34734 | Locked | SELECT accounts.screen_name,postings.url url, accounts.type owner_type, postings.id ID, postings.job |
| 685235 | irnadmin | 172.19.0.28:37502 | v3 | Query | 34734 | Locked | SELECT accounts.screen_name,postings.url url, accounts.type owner_type, postings.id ID, postings.job |
| 686496 | irnadmin | 172.19.0.239:33306 | v3 | Query | 32589 | Locked | SELECT accounts.screen_name,postings.url url, accounts.type owner_type, postings.id ID, postings.job |
| 686503 | irnadmin | 172.19.0.28:54051 | v3 | Query | 32588 | Locked | SELECT job_desc_title, job_desc, IF(postings.category IS NOT NULL, postings.category, job_categories |
| 709550 | root | localhost | v3 | Query | 0 | NULL | show processlist |
| 710084 | irnadmin | 172.19.0.27:53285 | NULL | Query | 0 | removing tmp table | show status where Variable_name='Threads_running' |
+--------+-------------+--------------------+------+---------+--------+----------------------------------+------------------------------------------------------------------------------------------------------+
49 rows in set (0.00 sec)
Newer versions of SQL support the process list in information_schema:
SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST
You can ORDER BY in any way you like.
The INFORMATION_SCHEMA.PROCESSLIST table was added in MySQL 5.1.7. You can find out which version you're using with:
SELECT VERSION()
The command
show full processlist
can be replaced by:
SELECT * FROM information_schema.processlist
but if you go with the latter version you can add WHERE clause to it:
SELECT * FROM information_schema.processlist WHERE `INFO` LIKE 'SELECT %';
For more information visit this
Another useful tool for this from the command line interface, is the pager command.
eg
pager grep -v Sleep | more; show full processlist;
Then you can page through the results.
You can also look for certain users, IPs or queries with grep or sed in this way.
The pager command is persistent per session.
You can just capture the output and pass it through a filter, something like:
mysql show processlist
| grep -v '^\+\-\-'
| grep -v '^| Id'
| sort -n -k12
The two greps strip out the header and trailer lines (others may be needed if there are other lines not containing useful information) and the sort is done based on the numeric field number 12 (I think that's right).
This one works for your immediate output:
mysql show processlist
| grep -v '^\+\-\-'
| grep -v '^| Id'
| grep -v '^[0-9][0-9]* rows in set '
| grep -v '^ '
| sort -n -k12
If you use old version of MySQL you can always use \P combined with some nice piece of awk code.
Interesting example here
http://www.dbasquare.com/2012/03/28/how-to-work-with-a-long-process-list-in-mysql/
Isn't it exactly what you need?
...We don't have a newer version of MySQL yet, so I was able to do this (works only on UNIX):
host=maindb
echo "show full processlist\G" | mysql -h$host | grep -B 6 -A 1 Locked
The above will query for all locked sessions, and return the information and SQL that is involved.
...So- assuming you wanted to query for sessions that were sleeping:
host=maindb
echo "show full processlist\G" | mysql -h$host | grep -B 6 -A 1 Sleep
Or, assuming you needed to provide additional connection parameters for MySQL:
host=maindb
user=me
password=mycoolpassword
echo "show full processlist\G" | mysql -h$host -u$user -p$password | grep -B 6 -A 1 Locked
With a couple of tweaks, I'm sure a shell script could be easily created to query the processlist the way you want it.
Use the "|" as separator
mysqladmin processlist| sort -t\| -n -k7
From sort manual ( man sort )
-k, --key=KEYDEF
sort via a key; KEYDEF gives location and type
-t, --field-separator=SEP
use SEP instead of non-blank to blank transition
-n, --numeric-sort
compare according to string numerical value
-r, --reverse
reverse the result of comparisons
Related
I am trying to use an inner join to retrieve the best ratings for certain categories with the following SQL statement:
select expertise.category, sk.type from expertise inner join
(select skills.expertise_uuid, skills.type, max(skills.rating) as rating
from skills grouped by skills.expertise_uuid) as sk
on sk.expertise_uuid = expertise.uuid);
I have the following two tables:
mysql> select * from expertise;
+--------------------------------------+-----------------------+----------+--------------------------------------+
| uuid | category | favorite | user_profile_uuid |
+--------------------------------------+-----------------------+----------+--------------------------------------+
| 2a325545-5713-4b56-b3a1-9655875e2da7 | Frameworks & Tools | 0 | 32251c91-aff3-4aa0-8350-8a556db9bcd5 |
| 6166a5c4-2b64-4658-896a-c99fc79fa7ce | Programming languages | 1 | 32251c91-aff3-4aa0-8350-8a556db9bcd5 |
| 91d8b6da-57f5-49ee-83fc-37b8ac430e49 | Databases | 0 | 32251c91-aff3-4aa0-8350-8a556db9bcd5 |
| b452ffc0-a920-4b5c-8e96-947e5c7e1a31 | OS & Software | 0 | 32251c91-aff3-4aa0-8350-8a556db9bcd5 |
| c338733f-3a58-4e90-978c-1977abf6001c | Application servers | 0 | 32251c91-aff3-4aa0-8350-8a556db9bcd5 |
| e0149f2b-5bb4-4f27-aa37-58b228409bec | Languages | 0 | 32251c91-aff3-4aa0-8350-8a556db9bcd5 |
| eac89c26-f204-4b25-9b7e-3cb66cc75962 | Test | 0 | 32251c91-aff3-4aa0-8350-8a556db9bcd5 |
+--------------------------------------+-----------------------+----------+--------------------------------------+
7 rows in set (0.00 sec)
mysql> select * from skills;
+--------------------------------------+--------+-------+------------+--------------------------------------+
| uuid | rating | scale | type | expertise_uuid |
+--------------------------------------+--------+-------+------------+--------------------------------------+
| 130580c4-9359-4486-9c73-1f6daeac183a | 6 | 10 | Linux | b452ffc0-a920-4b5c-8e96-947e5c7e1a31 |
| 17842ee5-c0c3-412f-8b6a-eff8a9f72f95 | 3 | 10 | C++ | 6166a5c4-2b64-4658-896a-c99fc79fa7ce |
| 1967f7ab-e039-466c-af4d-deaa1b2dc5fe | 6 | 10 | Subversion | 2a325545-5713-4b56-b3a1-9655875e2da7 |
| 1bac44e7-75c5-45a9-b11d-fa74727e68a4 | 7 | 10 | MySQL | 91d8b6da-57f5-49ee-83fc-37b8ac430e49 |
| 1f2bc3e9-83f8-44a7-aa6a-65bb7eebb279 | 6 | 10 | Android | 6166a5c4-2b64-4658-896a-c99fc79fa7ce |
| 26e542fb-5a3a-46fd-847f-d69cc09608fb | 8 | 10 | Java | 6166a5c4-2b64-4658-896a-c99fc79fa7ce |
| 28572313-a9f8-41d1-8a62-a2535df23787 | 5 | 10 | WebSphere | c338733f-3a58-4e90-978c-1977abf6001c |
| 55f30986-4b61-4347-aaca-2346799ccd42 | 10 | 10 | Slovene | e0149f2b-5bb4-4f27-aa37-58b228409bec |
| 5dad7632-6bbf-4b70-801b-d24e2f24560e | 7 | 10 | Eclipse | b452ffc0-a920-4b5c-8e96-947e5c7e1a31 |
| 676dc2b0-de01-47ef-8c10-be81a57d3a57 | 6 | 10 | JavaScript | 6166a5c4-2b64-4658-896a-c99fc79fa7ce |
| 8db56cf5-e00a-4652-8f08-39a6ba9961ed | 3 | 10 | Drinking | NULL |
| a184ee09-05ab-4228-ba5d-0019d578367d | 7 | 10 | Git | 2a325545-5713-4b56-b3a1-9655875e2da7 |
| a22331ed-ce03-4dd9-a541-23cdccb0bde3 | 8 | 10 | Windows | b452ffc0-a920-4b5c-8e96-947e5c7e1a31 |
| b32c8898-117f-4685-b988-0d6012d2fdaa | 2 | 10 | C# | 6166a5c4-2b64-4658-896a-c99fc79fa7ce |
| b93c9c13-68c3-4f95-88e0-3ae3609b36be | 8 | 10 | IntelliJ | b452ffc0-a920-4b5c-8e96-947e5c7e1a31 |
| be2a85aa-a093-441c-adf5-3c9415d6112f | 7 | 10 | MacOS | b452ffc0-a920-4b5c-8e96-947e5c7e1a31 |
| d5844c34-fa9a-45cc-913d-9fb82d408d7f | 7 | 10 | English | e0149f2b-5bb4-4f27-aa37-58b228409bec |
| d72e50c4-0fbc-415b-970e-d33c8386174d | 2 | 10 | Scala | 6166a5c4-2b64-4658-896a-c99fc79fa7ce |
| dfefcc91-194e-4b54-ab07-51e186f60c18 | 5 | 10 | PHP | 6166a5c4-2b64-4658-896a-c99fc79fa7ce |
| ee2d4b52-0b22-4d1c-a0b1-27a0d23ccbca | 6 | 10 | Oracle | 91d8b6da-57f5-49ee-83fc-37b8ac430e49 |
| fd936710-edff-4cdb-8924-ff513f0d2315 | 7 | 10 | Jetty | c338733f-3a58-4e90-978c-1977abf6001c |
+--------------------------------------+--------+-------+------------+--------------------------------------+
21 rows in set (0.00 sec)
How would I be able to retrieve the category from expertise and the corresponding type in skills for the highest rated skills (rating column)? The result should look like this:
+-----------------------+--------+--------+
| category | rating | type |
+-----------------------+--------+--------+
| Frameworks & Tools | 7 | Git |
| Programming languages | 8 | Java |
| Databases | 7 | MySQL |
| OS & Software | 8 | Eclipse|
| Application servers | 7 | Jetty |
| Languages | 10 | Slovene|
+-----------------------+--------+--------+
I looked up several stack overflow questions, but I did not find any answer that could be used in this example.
If I understand correctly, you can use row_number():
select es.*
from (select e.category, s.rating, s.type,
row_number() over (partition by e.category order by s.rating desc) as seqnum
from expertise e join
skills s
on e.uuid = s.expertise_uuid
) es
where seqnum = 1;
I finally found another solution with two joins. I finally understood I can first look up all rows with highest ratings per expertise:
mysql> select skills.uuid, s.maxrating, skills.type, skills.expertise_uuid
from skills inner join
(select expertise_uuid, max(rating) as maxrating from skills
group by expertise_uuid) as s
on skills.expertise_uuid = s.expertise_uuid and skills.rating = s.maxrating;
+--------------------------------------+-----------+----------+--------------------------------------+
| uuid | maxrating | type | expertise_uuid |
+--------------------------------------+-----------+----------+--------------------------------------+
| 1bac44e7-75c5-45a9-b11d-fa74727e68a4 | 7 | MySQL | 91d8b6da-57f5-49ee-83fc-37b8ac430e49 |
| 26e542fb-5a3a-46fd-847f-d69cc09608fb | 8 | Java | 6166a5c4-2b64-4658-896a-c99fc79fa7ce |
| 55f30986-4b61-4347-aaca-2346799ccd42 | 10 | Slovene | e0149f2b-5bb4-4f27-aa37-58b228409bec |
| a184ee09-05ab-4228-ba5d-0019d578367d | 7 | Git | 2a325545-5713-4b56-b3a1-9655875e2da7 |
| a22331ed-ce03-4dd9-a541-23cdccb0bde3 | 8 | Windows | b452ffc0-a920-4b5c-8e96-947e5c7e1a31 |
| b93c9c13-68c3-4f95-88e0-3ae3609b36be | 8 | IntelliJ | b452ffc0-a920-4b5c-8e96-947e5c7e1a31 |
| fd936710-edff-4cdb-8924-ff513f0d2315 | 7 | Jetty | c338733f-3a58-4e90-978c-1977abf6001c |
+--------------------------------------+-----------+----------+--------------------------------------+
7 rows in set (0.00 sec)
Once I have this, I can use it to join results with expertise table.
mysql> select expertise.category, s2.type, s2.maxrating from expertise
inner join
(select skills.uuid, s.maxrating, skills.type, skills.expertise_uuid
from skills inner join
(select expertise_uuid, max(rating) as maxrating from skills
group by expertise_uuid) as s
on skills.expertise_uuid = s.expertise_uuid and skills.rating = s.maxrating)
as s2 on expertise.uuid = s2.expertise_uuid;
+-----------------------+----------+-----------+
| category | type | maxrating |
+-----------------------+----------+-----------+
| Databases | MySQL | 7 |
| Programming languages | Java | 8 |
| Languages | Slovene | 10 |
| Frameworks & Tools | Git | 7 |
| OS & Software | Windows | 8 |
| OS & Software | IntelliJ | 8 |
| Application servers | Jetty | 7 |
+-----------------------+----------+-----------+
7 rows in set (0.00 sec)
'top' gives:
top - 13:07:35 up 827 days, 8:18, 2 users, load average: 5,26, 5,38, 5,45
KiB Mem: 32848512 total, 32265240 used, 583272 free, 261908 buffers
KiB Swap: 1046520 total, 313784 used, 732736 free, 28190744 cached
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
23927 mysql 20 0 917m 243m 8152 S 553,7 0,8 65:09.27 mysqld
mysql> SHOW FULL PROCESSLIST;
+------+--------+-----------------+-------------+---------+------+--------------+--------------------------------------------------------------------+
| Id | User | Host | db | Command | Time | State | Info |
+------+--------+-----------------+-------------+---------+------+--------------+--------------------------------------------------------------------+
| 600 | oneill | localhost | NULL | Query | 0 | NULL | SHOW FULL PROCESSLIST |
| 956 | oneill | 127.0.0.1:42219 | FoxPoker | Sleep | 0 | | NULL |
| 1318 | oneill | 127.0.0.1:44207 | FoxPoker | Sleep | 0 | | NULL |
| 1319 | oneill | 127.0.0.1:44210 | FoxPoker | Sleep | 0 | | NULL |
| 1321 | oneill | 127.0.0.1:44215 | FoxPoker | Sleep | 0 | | NULL |
| 1489 | oneill | 127.0.0.1:45218 | FoxPoker | Sleep | 0 | | NULL |
| 1490 | oneill | 127.0.0.1:45217 | FoxPoker | Sleep | 0 | | NULL |
| 1700 | oneill | 127.0.0.1:46246 | FoxPoker | Sleep | 0 | | NULL |
| 1701 | oneill | 127.0.0.1:46248 | FoxPoker | Sleep | 0 | | NULL |
| 2203 | oneill | 127.0.0.1:49218 | FoxPoker | Sleep | 0 | | NULL |
| 3262 | oneill | 127.0.0.1:54855 | FoxPoker | Sleep | 0 | | NULL |
| 3263 | oneill | 127.0.0.1:54858 | FoxPokerDev | Sleep | 0 | | NULL |
| 3462 | oneill | 127.0.0.1:56029 | FoxPoker | Sleep | 0 | | NULL |
| 4269 | oneill | 127.0.0.1:60551 | FoxPoker | Sleep | 0 | | NULL |
| 4945 | oneill | 127.0.0.1:36032 | FoxPoker | Query | 3 | Sending data | SELECT COUNT(deviceId) FROM devices WHERE BINARY deviceId="pMGmpY" |
| 4950 | oneill | 127.0.0.1:36073 | FoxPoker | Query | 1 | Sending data | SELECT COUNT(deviceId) FROM devices WHERE BINARY deviceId="tAf994" |
| 4952 | oneill | 127.0.0.1:36083 | FoxPoker | Query | 1 | Sending data | SELECT COUNT(deviceId) FROM devices WHERE BINARY deviceId="ea6Kv2" |
| 4954 | oneill | 127.0.0.1:36097 | FoxPoker | Query | 1 | Sending data | SELECT COUNT(deviceId) FROM devices WHERE BINARY deviceId="yFYvur" |
| 4955 | oneill | 127.0.0.1:36098 | FoxPoker | Query | 1 | Sending data | SELECT COUNT(deviceId) FROM devices WHERE BINARY deviceId="73qTcv" |
| 4956 | oneill | 127.0.0.1:36099 | FoxPoker | Query | 1 | Sending data | SELECT COUNT(deviceId) FROM devices WHERE BINARY deviceId="q64MfG" |
+------+--------+-----------------+-------------+---------+------+--------------+--------------------------------------------------------------------+
mysql> show status like '%onn%';
+--------------------------+-------+
| Variable_name | Value |
+--------------------------+-------+
| Aborted_connects | 1 |
| Connections | 5528 |
| Max_used_connections | 25 |
| Ssl_client_connects | 0 |
| Ssl_connect_renegotiates | 0 |
| Ssl_finished_connects | 0 |
| Threads_connected | 19 |
+--------------------------+-------+
7 rows in set (0.00 sec)
(Connections keep on growing.)
mysqladmin status -h localhost -u -p
Uptime: 924 Threads: 21 Questions: 92803 Slow queries: 1677 Opens: 1025 Flush tables: 1 Open tables: 265 Queries per second avg: 100.436
I restared mysql, optimized all tables and nothing changed.
Any idea ?
Login to MySQL and check for expensive queries using:
SHOW FULL PROCESSLIST;
Find the offending sql that's causing the 1600 slow queries and performance tune it.
You can also look to enable slow query logging via the below documentation.
https://dev.mysql.com/doc/refman/5.7/en/slow-query-log.html
MySQL 5.7.17 MGR deploy in single-primary mode, 3 node all one one machine, the same configuration.
And then we test insert on the primary node and observe that the slave nodes have high delay with the write node, even primary node finish the insert test, slave node data is incresing!
Why MySQL Group Replication slave nodes have high delay with write node?
here is the my.cnf:
[mysqld]
datadir=/dba/mysql/data/s1
basedir=/dba/mysql/mysql-5.7/
port=24801
socket=/dba/mysql/data/s1/s1.sock
server_id=1
gtid_mode=ON
enforce_gtid_consistency=ON
master_info_repository=TABLE
relay_log_info_repository=TABLE
binlog_checksum=NONE
log_slave_updates=ON
log_bin=binlog
binlog_format=ROW
transaction_write_set_extraction=XXHASH64
loose-group_replication_group_name="aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa"
loose-group_replication_start_on_boot=off
loose-group_replication_local_address= "127.0.0.1:24901"
loose-group_replication_group_seeds= "127.0.0.1:24901,127.0.0.1:24902,127.0.0.1:24903"
loose-group_replication_bootstrap_group= off
loose-group_replication_single_primary_mode=true
loose-group_replication_enforce_update_everywhere_checks=false
slave_parallel_type=LOGICAL_CLOCK
slave_preserve_commit_order=1
slave_parallel_workers=4
and the MGR config :
mysql> show variables like '%group_replication%';
+----------------------------------------------------+-------------------------------------------------+
| Variable_name | Value |
+----------------------------------------------------+-------------------------------------------------+
| group_replication_allow_local_disjoint_gtids_join | OFF |
| group_replication_allow_local_lower_version_join | OFF |
| group_replication_auto_increment_increment | 7 |
| group_replication_bootstrap_group | OFF |
| group_replication_components_stop_timeout | 31536000 |
| group_replication_compression_threshold | 1000000 |
| group_replication_enforce_update_everywhere_checks | OFF |
| group_replication_flow_control_applier_threshold | 25000 |
| group_replication_flow_control_certifier_threshold | 25000 |
| group_replication_flow_control_mode | QUOTA |
| group_replication_force_members | |
| group_replication_group_name | aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa |
| group_replication_group_seeds | 127.0.0.1:24901,127.0.0.1:24902,127.0.0.1:24903 |
| group_replication_gtid_assignment_block_size | 1000000 |
| group_replication_ip_whitelist | AUTOMATIC |
| group_replication_local_address | 127.0.0.1:24901 |
| group_replication_poll_spin_loops | 0 |
| group_replication_recovery_complete_at | TRANSACTIONS_APPLIED |
| group_replication_recovery_reconnect_interval | 60 |
| group_replication_recovery_retry_count | 10 |
| group_replication_recovery_ssl_ca | |
| group_replication_recovery_ssl_capath | |
| group_replication_recovery_ssl_cert | |
| group_replication_recovery_ssl_cipher | |
| group_replication_recovery_ssl_crl | |
| group_replication_recovery_ssl_crlpath | |
| group_replication_recovery_ssl_key | |
| group_replication_recovery_ssl_verify_server_cert | OFF |
| group_replication_recovery_use_ssl | OFF |
| group_replication_single_primary_mode | ON |
| group_replication_ssl_mode | DISABLED |
| group_replication_start_on_boot | OFF |
+----------------------------------------------------+-------------------------------------------------+
32 rows in set (0.01 sec)
my homework require me to execute those queries and show the result. Thing is I can export the table into CSV or excel just fine, but the TA require me to somehow show the exact command line that give it the table.
Is there some statements like log or something to do that?
You can use the mysql command from the shell with the -v option, it will display the query followed by the results:
$ mysql -v -e 'select * from barmar_test';
--------------
select * from barmar_test
--------------
+-----------+-----------+---------+------+------+---------------------+------+
| username | timestamp | partner | e | en | t | ttx |
+-----------+-----------+---------+------+------+---------------------+------+
| foo | NULL | abc | N1 | NULL | 2013-07-03 23:27:47 | NULL |
| foo | NULL | abc | 1 | NULL | 2013-07-03 23:25:12 | NULL |
| NULL | NULL | abc | 12 | NULL | 2013-07-03 23:25:12 | NULL |
| foo | NULL | abc | NULL | NULL | 2013-08-30 15:01:39 | NULL |
| foobarbaz | NULL | abc | NULL | NULL | 2013-09-02 13:04:00 | NULL |
+-----------+-----------+---------+------+------+---------------------+------+
I uploaded an image to glance, an Ubuntu server 12.04 in a vhd format and when i'm trying to boot that image with nova boot i receive this:
+-------------------------------------+--------------------------------------+
| Property | Value |
+-------------------------------------+--------------------------------------+
| OS-DCF:diskConfig | MANUAL |
| OS-EXT-SRV-ATTR:host | None |
| OS-EXT-SRV-ATTR:hypervisor_hostname | None |
| OS-EXT-SRV-ATTR:instance_name | instance-00000004 |
| OS-EXT-STS:power_state | 0 |
| OS-EXT-STS:task_state | scheduling |
| OS-EXT-STS:vm_state | building |
| accessIPv4 | |
| accessIPv6 | |
| adminPass | PK2mwUZ7SJEH |
| config_drive | |
| created | 2012-12-19T17:21:48Z |
| flavor | m1.tiny |
| hostId | |
| id | 716c9276-648c-4f90-9e67-43b8f41feb91 |
| image | Ubuntu |
| key_name | key1 |
| metadata | {} |
| name | vm1 |
| progress | 0 |
| security_groups | [{u'name': u'default'}] |
| status | BUILD |
| tenant_id | 73e54a9f1ddc46fa9bd0a99d5e2a1cda |
| updated | 2012-12-19T17:21:54Z |
| user_id | dc9c0376d5604467b3898082fd270b1c |
+-------------------------------------+--------------------------------------+
ubuntu#ubuntu:~/vmware-tools-distrib$ cd /
ubuntu#ubuntu:/$ cd /home/ubuntu/devstack/
ubuntu#ubuntu:~/devstack$ nova list
+--------------------------------------+------+--------+----------+
| ID | Name | Status | Networks |
+--------------------------------------+------+--------+----------+
| 716c9276-648c-4f90-9e67-43b8f41feb91 | vm1 | ERROR | |
| 77aa0d77-2dae-4d18-a827-f08d0fb2f71a | vm1 | ERROR | |
+--------------------------------------+------+--------+----------+
So, what may be the problem??
Thanks!
you can access the database to get the detail reason if there is no obvious information in log file, query nova.instance_faults table will give you more information about why this instance became error status.
look at the nova-network.log if there is an error which is related dhcpbridge file, add that line to nova.conf
dhcpbridge = /usr/bin/nova-dhcpbridge
hint: if there is a builted image(nova list) delete it and then restart all nova-* services