Чистим историю в базе данных zabbix

Ни для кого не секрет , что со временем база данных zabbix увеличивается. Поэтому покажу вам как ее почистить в базе. Итак, подключаемся любым удобным клиентом к базе mysql и далее по списку.

  1. Останавливаем сервис zabbix
    /etc/init.d/zabbix_server stop
  2. Создаем новые таблицы по аналогии с оригинальными
    CREATE TABLE history_uint_new LIKE history_uint
    CREATE TABLE history_new LIKE history
  3. Переносим в нее данные за последние N-дней. В моем случае 30 дней.
    INSERT IGNORE INTO history_uint_new SELECT * FROM history_uint WHERE clock > UNIX_TIMESTAMP(DATE_SUB(NOW(), INTERVAL 1 day))

    У меня при переносе mysql выдал ошибку ERROR 1206 (HY000): The total number of locks exceeds the lock table size. Чтобы это исправить я добавил параметр в конфиге /etc/my.cnf: innodb_buffer_pool_size = 100M. После чего нужено рестартануть сервис.

  4. Переименовываем таблицы и удаляем старые таблицы
    ALTER TABLE history_uint RENAME history_uint_old
    ALTER TABLE history_uint_new RENAME history_uint
    DROP TABLE history_uint_old
    ALTER TABLE history RENAME history_old 
    ALTER TABLE history_new RENAME history
    DROP TABLE history_old
  5. Запускаем сервис
    /etc/init.d/zabbix_server start

Note: если у вас разрослась база, то можно воспользоваться руководством

26 комментариев к “Чистим историю в базе данных zabbix

  1. The next time I read a blog, I hope that it won’t fail me just as much as this particular one. I mean, I know it was my choice to read, nonetheless I genuinely thought you would have something interesting to say. All I hear is a bunch of crying about something you can fix if you weren’t too busy looking for attention.

  2. Hmm it looks like your blog ate my first comment (it was extremely long) so I guess I’ll just sum it up what I wrote and say, I’m thoroughly enjoying your blog. I as well am an aspiring blog writer but I’m still new to everything. Do you have any recommendations for first-time blog writers? I’d definitely appreciate it.

  3. Great article. I discover something extra challenging on various blogs day-to-day. It will certainly always be promoting to review content from other writers and practice a something from their shop. I?d favor to utilize some with the content on my blog whether you don?t mind. Natually I?ll offer you a web link on your web blog. Many thanks for sharing.

  4. Have you ever considered publishing an e-book or guest authoring on other websites?
    I have a blog centered on the same ideas you discuss and would really like to
    have you share some stories/information. I know my subscribers would
    value your work. If you are even remotely interested,
    feel free to shoot me an email.

  5. Nice post. I learn something new and challenging on websites I stumbleupon on a daily basis. It’s always exciting to read articles from other authors and use a little something from other sites.

  6. I have to thank you for the efforts you have put in penning this site. I really hope to see the same high-grade blog posts from you later on as well. In truth, your creative writing abilities has inspired me to get my very own site now 😉

  7. naturally like your website but you need to check the spelling on several of your posts.

    Many of them are rife with spelling issues and I in finding it
    very troublesome to tell the reality nevertheless I’ll surely come again again.

  8. The next time I check out a blog, I hope that it doesn’t disappoint me as high as this. I indicate, I understand it was my selection to read, yet I in fact thought youd have something interesting to claim. All I hear is a number of whimpering concerning something that you could fix if you werent as well hectic seeking focus.

  9. I discovered your blog site on google and also check a few of your very early posts. Continue to keep up the very good run. I just additional up your RSS feed to my MSN News Visitor. Looking for forward to learning more from you later!?

  10. Youre so cool! I don’t suppose Ive read anything such as this before. So good to find somebody with some original ideas on this subject. realy thanks for starting this up. this site is something that is required on the web, somebody with a little originality. beneficial job for bringing something new to the web!

  11. Youre so great! I do not suppose Ive check out anything like this prior to. So wonderful to find someone with some original ideas on this subject. realy thanks for starting this up. this internet site is something that is required online, somebody with a little originality. useful work for bringing something new to the internet!

Оставить ответ

Ваш адрес email не будет опубликован. Обязательные поля помечены *