Python脚本之django---mysql-记录主机性能数据到数据库-web站点管理数据库及web显示命令执行结果

本文涉及的产品
RDS MySQL Serverless 基础系列,0.5-2RCU 50GB
云数据库 RDS MySQL,集群系列 2核4GB
推荐场景:
搭建个人博客
云数据库 RDS PostgreSQL,集群系列 2核4GB
简介:

##############################################################环境

[root@LVS1 python]# cat /etc/redhat-release 

Red Hat Enterprise Linux Server release 6.4 (Santiago)

You have new mail in /var/spool/mail/root

[root@LVS1 python]# python -V

Python 2.6.6

[root@LVS1 python]#

#############################################################安装paramiko

[root@LVS1 ~]# yum install gcc

[root@LVS1 ~]# yum install python-devel

[root@LVS1 ~]#tar -zxvf pycrypto-2.6.1.tar.gz#https://pypi.python.org/pypi/pycrypto

[root@LVS1 ~]#cd pycrypto-2.6.1

[root@LVS1 pycrypto-2.6.1]#python setup.py install

[root@LVS1 ~]#tar -zxvf paramiko-1.10.1.tar.gz#https://pypi.python.org/pypi/paramiko

[root@LVS1 ~]#cd paramiko-1.10.1

[root@LVS1 paramiko-1.10.1]# python setup.py install

[root@LVS1 demos]# python demo.py 192.168.1.10#测试

#############################################################安装django

[root@LVS1 python]# tar -zxvf Django-1.5.1.tar.gz

[root@LVS1 python]# cd Django-1.5.1

[root@LVS1 Django-1.5.1]# python setup.py install

[root@LVS1 Django-1.5.1]# cd django/bin/

[root@LVS1 bin]# ./django-admin.py startproject myweb

[root@LVS1 bin]# cd myweb

[root@LVS1 bin]# service iptables stop

[root@LVS1 myweb]# ./manage.py runserver 0.0.0.0:8000

#http://192.168.1.10:8000/

#############################################################安装python-MySQLdb

#yum install mysql-server

#service  mysqld start

#chkconfig --level 345 mysqld on

#[root@LVS1 ~]# mysql -u root

#mysql>  SET PASSWORD FOR 'root'@'localhost' = PASSWORD('123456');

#mysql> show databases;

#mysql> use mysql;

#mysql> show tables;

mysql> create database Filesystem;

#mysql>quit

[root@LVS1 ~]#yum install MySQL-python

#########################################################将输出结果直接返回到页面上

[root@LVS1 bin]# cd myweb

[root@LVS1 myweb]# pwd

/tmp/python/Django-1.5.1/django/bin/myweb/myweb

vi view.py

from django.http import HttpResponse

import datetime,time,os

def hello(request):

        return HttpResponse('hello my name is xk')

def current_time(request):

        now=datetime.datetime.now()

        html="It is now :%s"%now

        return HttpResponse(html)

def cpu(request):

        status=os.popen('top -bn 1').read()

        html="<pre>%s"%status

        return HttpResponse(html)

def hours_ahead(request,h):

        offset=int(h)

        dt=datetime.datetime.now() + datetime.timedelta(hours=offset)

        html="In %s hours later,It is %s"%(h,dt)

        return HttpResponse(html)

-------------------------------------------------

[root@LVS1 myweb]# vi urls.py

from django.conf.urls import patterns, include, url


# Uncomment the next two lines to enable the admin:

# from django.contrib import admin

# admin.autodiscover()

from myweb.view import hello,current_time,cpu,hours_ahead


urlpatterns = patterns('',

    # Examples:

    # url(r'^$', 'myweb.views.home', name='home'),

    # url(r'^myweb/', include('myweb.foo.urls')),


    # Uncomment the admin/doc line below to enable admin documentation:

    # url(r'^admin/doc/', include('django.contrib.admindocs.urls')),


    # Uncomment the next line to enable the admin:

    # url(r'^admin/', include(admin.site.urls)),

      (r'^hello/$',hello),

        (r'^time/$',current_time),

        (r'^cpu/$',cpu),

        (r'^time/plus/(\d{1,2})/$',hours_ahead),

)


#http://192.168.1.10:8000/hello/

http://192.168.1.10:8000/time/

http://192.168.1.10:8000/cpu/

http://192.168.1.10:8000/time/plus/2/#返回当前时间加上2小时之后的时间

#########################################################利用模板显示输出结果到页面上

[root@LVS1 myweb]# pwd

/tmp/python/Django-1.5.1/django/bin/myweb/myweb

[root@LVS1 myweb]# tail -2000 view2.py

from django.shortcuts import render_to_response

import os

import paramiko

hosts=['192.168.1.10','192.168.1.10','192.168.1.11','192.168.1.10','192.168.1.11','192.168.1.13']

username='root'

password='123456'

port=22

d_usage={}

d_usage2={}

def disk(request):

        i=0

        for hostname in hosts:

                i=i+1

                if os.system('ping %s -c 1'%hostname)==0:

                        paramiko.util.log_to_file('paramiko.log')

                        s = paramiko.SSHClient()

                        s.set_missing_host_key_policy(paramiko.AutoAddPolicy())

                        s.connect(hostname,port,username,password)

                        stdin,stdout,stderr=s.exec_command('df -kP')

                        d_usage[hostname+'__%s'%i]= stdout.read()

                        s.close()

                else:

                        d_usage2[hostname+'__%s'%i]='host Destination Host Unreachable'

                        name={'xk':[25,'male'],'zq':[23,'male'],}

        sum1=len(d_usage)

        sum2=len(d_usage2)

        sum=sum1+sum2

        return render_to_response('disk.html',{"d_usage":d_usage,'name':name,'sum':sum,'d_usage2':d_usage2,})

------------------------------------------------------------

[root@LVS1 myweb]# vi urls.py

from django.conf.urls import patterns, include, url


# Uncomment the next two lines to enable the admin:

# from django.contrib import admin

# admin.autodiscover()

from myweb.view2 import disk


urlpatterns = patterns('',

    # Examples:

    # url(r'^$', 'myweb.views.home', name='home'),

    # url(r'^myweb/', include('myweb.foo.urls')),


    # Uncomment the admin/doc line below to enable admin documentation:

    # url(r'^admin/doc/', include('django.contrib.admindocs.urls')),


    # Uncomment the next line to enable the admin:

    # url(r'^admin/', include(admin.site.urls)),

(r'^disk/$',disk),

)


------------------------------------------------------------

[root@LVS1 myweb]#mkdir templates

[root@LVS1 myweb]#vi /tmp/python/Django-1.5.1/django/bin/myweb/myweb/settings.py

TEMPLATE_DIRS = (

    # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates".

    # Always use forward slashes, even on Windows.

    # Don't forget to use absolute paths, not relative paths.

    '/tmp/python/Django-1.5.1/django/bin/myweb/myweb/templates',

[root@LVS1 templates]# pwd

/tmp/python/Django-1.5.1/django/bin/myweb/myweb/templates

[root@LVS1 templates]# tail -1000 disk.html

<html>

<body>

<center> show disk usage</center></br>

hosts:sum-- `sum`</br>

{%for line in d_usage2.keys%}

     <font color=red>   `line`;</font>

{%endfor%}</br>

{%for line in d_usage.keys%}

        `line`;

{%endfor%}</br></br></br></br>

{% for ip,value in d_usage2.items %}

---------------------------------host`ip`----------------------------------

<font color=red><pre>   `value`</pre></font>


{% endfor %}

{% for ip,value in d_usage.items %}

---------------------------------host`ip`----------------------------------

<pre>   `value`</pre>


{% endfor %}

-----------------------------------------------------------------------------</br>

        `name`

</body>

</html>

####################################将主机文件系统、内存情况,cpu空闲率记录到MySQL数据库中

#注:先在MySQL数据库中创建好名为python的数据库,并赋给用户权限和密码

[root@LVS1 myweb]# pwd

/tmp/python/Django-1.5.1/django/bin/myweb/myweb

[root@LVS1 myweb]# vi settings.py

DATABASES = {

    'default': {

        'ENGINE': 'django.db.backends.mysql', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.

        'NAME': 'Filesystem',                      # Or path to database file if using sqlite3.

        # The following settings are not used with sqlite3:

        'USER': 'root',

        'PASSWORD': '123456',

        'HOST': '',                      # Empty for localhost through domain sockets or '127.0.0.1' for localhost through TC

P.

        'PORT': '',                      # Set to empty string for default.

    }

}

INSTALLED_APPS = (

    'django.contrib.auth',

    'django.contrib.contenttypes',

    'django.contrib.sessions',

    'django.contrib.sites',

    'django.contrib.messages',

    'django.contrib.staticfiles',

    # Uncomment the next line to enable the admin:

     'django.contrib.admin',

    # Uncomment the next line to enable admin documentation:

    # 'django.contrib.admindocs',

        'pyweb'

[root@LVS1 myweb]# pwd

/tmp/python/Django-1.5.1/django/bin/myweb

[root@LVS1 myweb]# ./manage.py startapp pyweb

[root@LVS1 pyweb]# pwd

/tmp/python/Django-1.5.1/django/bin/myweb/pyweb

[root@LVS1 pyweb]# tail -2000 models.py

from django.db import models


# Create your models here.

from django.db import models


class Filesystem(models.Model):

    ip = models.CharField(max_length=30)

    date_time = models.CharField(max_length=50)

    Filesystem = models.CharField(max_length=120)

    sum_kb = models.CharField(max_length=60)

    Used = models.CharField(max_length=30)

    Available = models.CharField(max_length=50)

    Capacity = models.CharField(max_length=60)

    Mounted_on = models.CharField(max_length=60)

    def __unicode__(self):

        return self.ip

class Men_Cpu(models.Model):

        ip = models.CharField(max_length=30)

        date_time = models.CharField(max_length=50)

        Men_sum_kb = models.CharField(max_length=40)

        Men_used = models.CharField(max_length=40)

        Men_free = models.CharField(max_length=40)

        Men_idle = models.CharField(max_length=40)

        Cpu_idle = models.CharField(max_length=40)

        def __unicode__(self):

            return self.ip

class Tablespace(models.Model):

    ip = models.CharField(max_length=30)

    date_time = models.CharField(max_length=50)

    

    TABLESPACE_NAME = models.CharField(max_length=120)

    SUMMARY = models.CharField(max_length=60)

    FREE = models.CharField(max_length=30)

    MAX_FREE_EXTENT = models.CharField(max_length=50)

    FREE_EXTENTS = models.CharField(max_length=60)

    USED = models.CharField(max_length=60)

    def __unicode__(self):

        return self.ip


#class Book(models.Model):

#    title = models.CharField(max_length=100)

#    authors = models.ManyToManyField(Author)

#    publisher = models.ForeignKey(Publisher)

#    publication_date = models.DateField()

#    country = models.CharField(defau="CN",max_length=50)#默认值为CN

#    def __unicode__(self):

#        return self.title

[root@LVS1 pyweb]# 

[root@LVS1 myweb]# pwd

/tmp/python/Django-1.5.1/django/bin/myweb

[root@LVS1 myweb]# python manage.py validate

0 errors found

[root@LVS1 myweb]# python manage.py sqlall pyweb

[root@LVS1 myweb]# python manage.py syncdb

---------------------------------------------------web站点管理上面的数据库

[root@LVS1 myweb]# pwd

/tmp/python/Django-1.5.1/django/bin/myweb/myweb

[root@LVS1 myweb]# vi settings.py

INSTALLED_APPS = (

    'django.contrib.auth',

    'django.contrib.contenttypes',

    'django.contrib.sessions',

    'django.contrib.sites',

    'django.contrib.messages',

    'django.contrib.staticfiles',

    # Uncomment the next line to enable the admin:

     'django.contrib.admin',

    # Uncomment the next line to enable admin documentation:

    # 'django.contrib.admindocs',

        'pyweb'

)

[root@LVS1 myweb]# vi urls.py

from django.conf.urls import patterns, include, url


# Uncomment the next two lines to enable the admin:

from django.contrib import admin

admin.autodiscover()



urlpatterns = patterns('',

    # Examples:

    # url(r'^$', 'myweb.views.home', name='home'),

    # url(r'^myweb/', include('myweb.foo.urls')),


    # Uncomment the admin/doc line below to enable admin documentation:

    # url(r'^admin/doc/', include('django.contrib.admindocs.urls')),


    # Uncomment the next line to enable the admin:

     url(r'^admin/', include(admin.site.urls)),

       # (r'^disk/$',disk),

)


[root@LVS1 pyweb]# tail -2000 admin.py

from django.contrib import admin

from pyweb.models import Filesystem,Men_Cpu,Tablespace 

class Filesystem_adin(admin.ModelAdmin):

        list_display=('ip','date_time','Filesystem','sum_kb','Used','Available','Capacity','Mounted_on')

        list_filter=('ip','date_time',)

        search_fields=('ip','date_time','Filesystem')

        ordering=('-date_time',)



class Men_Cpu_admin(admin.ModelAdmin):

        list_display=('ip','date_time','Men_sum_kb','Men_used','Men_free','Men_idle','Cpu_idle')

        list_filter=('ip','date_time',)

        search_fields=('ip','date_time',)

        ordering=('-date_time',)


class Tablespace_admin(admin.ModelAdmin):

        list_display=('ip','date_time','TABLESPACE_NAME','SUMMARY','FREE','MAX_FREE_EXTENT','FREE_EXTENTS','USED')

        list_filter=('ip','date_time',)

        search_fields=('ip','date_time','TABLESPACE_NAME')

        ordering=('-date_time',)


admin.site.register(Filesystem,Filesystem_adin)

admin.site.register(Men_Cpu,Men_Cpu_admin)

admin.site.register(Tablespace,Tablespace_admin)


#admin.site.register(Author)

#admin.site.register(Book)


[root@LVS1 myweb]# ./manage.py syncdb

[root@LVS1 myweb]#echo "python /tmp/python/Django-1.5.1/django/bin/myweb/manage.py runserver 0.0.0.0:8000  &>/tmp/dgangomyweb.txt &">>/etc/rc.local

http://192.168.1.10:8000/admin/#用户名和密码为第一次执行python manage.py syncdb时创建的

------------------------创建脚本(将主机文件系统、内存情况,cpu空闲率记录到MySQL数据库中)

[root@LVS1 pyweb]# tail -2000 /tmp/python/alldjango-mysql.py

#!/bin/usr/bin python

import os,datetime,paramiko

import tab,sys,multiprocessing,time

sys.path.append('/tmp/python/Django-1.5.1/django/bin/myweb')

os.environ['DJANGO_SETTINGS_MODULE'] = 'myweb.settings' 

from pyweb.models import Filesystem,Men_Cpu,Tablespace

#hosts=['192.168.1.10','192.168.1.11','192.168.1.13','192.168.1.200','192.168.1.11']

hosts=['192.168.1.10','192.168.1.11','192.168.1.13','192.168.1.10','192.168.1.200']

username='root'

password='123456'

port=22

time=datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S')

def run_cmd(ip):

        list=[]

        list0=[]

#       if os.system('ping %s -c 1 &>/dev/null'%ip)==0:

        try:

                        paramiko.util.log_to_file('paramiko.log')

                        s = paramiko.SSHClient()

                        s.set_missing_host_key_policy(paramiko.AutoAddPolicy())

                        s.connect(ip,port,username,password)

                        stdin,stdout,stderr=s.exec_command('df -kP')

                        df= stdout.read().split('\n')

                        stdin,stdout,stderr=s.exec_command("free|grep Mem|awk '{print $2}'")

                        list.append(stdout.read().strip())

                        stdin,stdout,stderr=s.exec_command("free|grep 'buffers/'|awk '{print $3}'")

                        list.append(stdout.read().strip())

                        stdin,stdout,stderr=s.exec_command("free|grep 'buffers/'|awk '{print $4}'")

                        list.append(stdout.read().strip())

                        list.append('%s'%(float(list[2])/float(list[0])))

                        stdin,stdout,stderr=s.exec_command("vmstat 1 2|sed -n '4p'|awk '{print $(NF-2)}'")

                        list.append(stdout.read().strip())


                        try:

                                stdin,stdout,stderr=s.exec_command('sh /tmp/tablespace.sh')

                                list0=stdout.read().split('\n')

                                list0.pop(0)

                                list0.pop(0)

                                list0.pop(0)

                                list0.pop(-1)

                        except:

                                list0=['null  null  null  null  null   null']



                        s.close()

                        print 'xxxx',ip

#       else:

        except:

                list=['null','null','null','null','null']

                df= 'nul \n null null null  null null null \n'.split('\n')

                list0=['null  null  null  null  null   null']

                print 'butong',ip

        #time=datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S')

        df.pop(0)

        df.pop(-1)

        for line in df:

               

               list00=line.split()

               p1 = Filesystem(ip='%s'%ip,date_time='%s'%time,Filesystem='%s'%list00[0], sum_kb='%s'%list00[1],Used='%s'%list00[2], Available='%s'%list00[3], Capacity='%s'%list00[4],Mounted_on='%s'%list00[5])

               p1.save()


        p2 = Men_Cpu(ip='%s'%ip,date_time='%s'%time,Men_sum_kb='%s'%list[0], Men_used='%s'%list[1],Men_free='%s'%list[2], Men_idle='%s'%list[3], Cpu_idle='%s'%list[4])

        p2.save()


        for list in list0:

                list=list.split()

                p3 = Tablespace(ip='%s'%ip,date_time='%s'%time,TABLESPACE_NAME='%s'%list[0], SUMMARY='%s'%list[1],FREE='%s'%list[2], MAX_FREE_EXTENT='%s'%list[3], FREE_EXTENTS='%s'%list[4],USED='%s'%list[5])

                p3.save()


p=multiprocessing.Pool(processes=10)

for hostname in hosts:

        p.apply_async(run_cmd,('%s'%hostname,))

        print hostname

#time.sleep(240)

print len(hosts)

time2=datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S')

print time2

p.close()

p.join()

time3=datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S')

print time2

print time3

[root@LVS1 pyweb]# 

[root@LVS1 pyweb]# crontab -l

*/10 * * * * python /tmp/python/alldjango-mysql.py #每10分钟一次将主机文件系统、内存情况,cpu空闲率记录到MySQL数据库中


------------------------------------附:在装有oracle数据库的远程主机上创建查询表空间的脚本

[root@redhata ~]# vi /tmp/tablespace.sh 

#!/bin/bash

export PATH=/u01/app/oracle/product/11.2.0/dbhome_1/bin:$PATH

export ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1/

sqlplus -S /nolog <<eof

conn system/123456@orcl

set line 200;

set feedback off;

set pagesize 50000;

col member for a45;

select a.tablespace_name,a.summary,b.free,b.maxf "MAX_FREE_EXTENT",b.free_exts "FREE_EXTENTS",

    100-b.free/a.summary*100 "USED%"

        from

           (select tablespace_name,sum(bytes/1024/1024) "SUMMARY" from dba_data_files

               group by tablespace_name) a,

                   (select tablespace_name,sum(bytes/1024/1024) "FREE",max(bytes/1024/1024)

                      "MAXF" ,count(*) free_exts

                          from dba_free_space group by tablespace_name) b

                              where a.tablespace_name=b.tablespace_name

                                 order by 6 desc;

eof

                                 exit;

##########################################################################################

vi  /tmp/python/Django-1.5.1/django/bin/myweb/myweb/settings.py #修改时区

TIME_ZONE = 'Aisa/Shanghai'

#########################################################################

Django-1.5.1版本

vi /usr/lib/python2.6/site-packages/django/contrib/admin/templates/admin/base_site.html

{% extends "admin/base.html" %}

{% load i18n %}


{% block title %}` title ` | {% trans '主机性能记录系统' %}{% endblock %}


{% block branding %}

<h1 id="site-name">{% trans '主机性能记录系统' %}</h1>

{% endblock %}


{% block nav-global %}{% endblock %}

------------------------------------------------------

Django-1.9.13版本

python -c "import sys;sys.path=sys.path[1:];import django;print(django.__path__)"#找到源文件目录

cd /usr/local/lib/python3.6/site-packages/Django-1.9.13-py3.6.egg/django/contrib/admin

vi sites.py

class AdminSite(object):

    """

    An AdminSite object encapsulates an instance of the Django admin application, ready

    to be hooked in to your URLconf. Models are registered with the AdminSite using the

    register() method, and the get_urls() method can then be used to access Django view

    functions that present a full admin interface for the collection of registered

    models.

    """


    # Text to put at the end of each page's <title>.

    site_title = ugettext_lazy('配置管理系统')

    #site_title = ugettext_lazy('Django site admin')


    # Text to put in each page's <h1>.

    site_header = ugettext_lazy('配置管理系统')

    #site_header = ugettext_lazy('Django administration')


    # Text to put at the top of the admin index page.

    index_title = ugettext_lazy('配置管理系统')

    #index_title = ugettext_lazy('Site administration')


    # URL for the "View site" link at the top of each admin page.


#####################################################

[root@LVS1 myweb# pwd

/tmp/python/Django-1.5.1/django/bin/myweb

[root@LVS1 myweb]# ./manage.py shell

In [2]: from pyweb.models import Publisher

In [3]: p1 = Publisher(name='shanghai', address='24242 chuansha road',city='ShangHai', state_province='CN', country='China',website='http://www.xxk.com/')                        

In [4]: p1.save()


In [5]: p1.name='hefei'

In [6]: p1.save()

##################################################################

echo "python /tmp/python/Django-1.5.1/django/bin/myweb/manage.py runserver 0.0.0.0:8000 &>/tmp/dgangomyweb.txt &"  >>/etc/rc.local#开机启动















本文转自shangshanyang51CTO博客,原文链接:http://blog.51cto.com/qqran/1965836 ,如需转载请自行联系原作者



相关实践学习
如何快速连接云数据库RDS MySQL
本场景介绍如何通过阿里云数据管理服务DMS快速连接云数据库RDS MySQL,然后进行数据表的CRUD操作。
全面了解阿里云能为你做什么
阿里云在全球各地部署高效节能的绿色数据中心,利用清洁计算为万物互联的新世界提供源源不断的能源动力,目前开服的区域包括中国(华北、华东、华南、香港)、新加坡、美国(美东、美西)、欧洲、中东、澳大利亚、日本。目前阿里云的产品涵盖弹性计算、数据库、存储与CDN、分析与搜索、云通信、网络、管理与监控、应用服务、互联网中间件、移动服务、视频服务等。通过本课程,来了解阿里云能够为你的业务带来哪些帮助 &nbsp; &nbsp; 相关的阿里云产品:云服务器ECS 云服务器 ECS(Elastic Compute Service)是一种弹性可伸缩的计算服务,助您降低 IT 成本,提升运维效率,使您更专注于核心业务创新。产品详情: https://www.aliyun.com/product/ecs
目录
打赏
0
0
0
0
143
分享
相关文章
【YashanDB知识库】原生mysql驱动配置连接崖山数据库
【YashanDB知识库】原生mysql驱动配置连接崖山数据库
【YashanDB知识库】原生mysql驱动配置连接崖山数据库
docker拉取MySQL后数据库连接失败解决方案
通过以上方法,可以解决Docker中拉取MySQL镜像后数据库连接失败的常见问题。关键步骤包括确保容器正确启动、配置正确的环境变量、合理设置网络和权限,以及检查主机防火墙设置等。通过逐步排查,可以快速定位并解决连接问题,确保MySQL服务的正常使用。
235 82
如何优化SQL查询以提高数据库性能?
这篇文章以生动的比喻介绍了优化SQL查询的重要性及方法。它首先将未优化的SQL查询比作在自助餐厅贪多嚼不烂的行为,强调了只获取必要数据的必要性。接着,文章详细讲解了四种优化策略:**精简选择**(避免使用`SELECT *`)、**专业筛选**(利用`WHERE`缩小范围)、**高效联接**(索引和限制数据量)以及**使用索引**(加速搜索)。此外,还探讨了如何避免N+1查询问题、使用分页限制结果、理解执行计划以及定期维护数据库健康。通过这些技巧,可以显著提升数据库性能,让查询更高效流畅。
时序数据库 InfluxDB 3.0 版本性能实测报告:写入吞吐量提升效果验证
TSBS 测试表明,对于少于 100 万台设备的数据集,InfluxDB OSS 3.0 的数据写入速度实际上比 InfluxDB OSS 1.8 更慢。 对于 100 万台及以上设备的数据集,InfluxDB OSS 3.0 的数据写入性能才开始超过 InfluxDB OSS 1.8。 InfluxDB OSS 3.0 的数据写入接口与 InfluxDB 1.8 并不兼容,用户无法顺利迁移。
66 7
缓存与数据库的一致性方案,Redis与Mysql一致性方案,大厂P8的终极方案(图解+秒懂+史上最全)
缓存与数据库的一致性方案,Redis与Mysql一致性方案,大厂P8的终极方案(图解+秒懂+史上最全)
MySQL生产环境迁移至YashanDB数据库深度体验
这篇文章是作者将 MySQL 生产环境迁移至 YashanDB 数据库的深度体验。介绍了 YashanDB 迁移平台 YMP 的产品相关信息、安装步骤、迁移中遇到的各种兼容问题及解决方案,最后总结了迁移体验,包括工具部署和操作特点,也指出功能有优化空间及暂不支持的部分,期待其不断优化。
云数据库:从零到一,构建高可用MySQL集群
在互联网时代,数据成为企业核心资产,传统单机数据库难以满足高并发、高可用需求。云数据库通过弹性扩展、分布式架构等优势解决了这些问题,但也面临数据安全和性能优化挑战。本文介绍了如何从零开始构建高可用MySQL集群,涵盖选择云服务提供商、创建实例、配置高可用架构、数据备份恢复及性能优化等内容,并通过电商平台案例展示了具体应用。
从 MySQL 到时序数据库 TDengine:Zendure 如何实现高效储能数据管理?
TDengine 助力广州疆海科技有限公司高效完成储能业务的数据分析任务,轻松应对海量功率、电能及输入输出数据的实时统计与分析,并以接近 1 : 20 的数据文件压缩率大幅降低存储成本。此外,taosX 强大的 transform 功能帮助用户完成原始数据的清洗和结构优化,而其零代码迁移能力更实现了历史数据从 TDengine OSS 与 MySQL 到 TDengine 企业版的平滑迁移,全面提升了企业的数据管理效率。本文将详细解读这一实践案例。
41 0
|
25天前
|
从 MongoDB 到 时序数据库 TDengine,沃太能源实现 18 倍写入性能提升
沃太能源是国内领先储能设备生产厂商,数十万储能终端遍布世界各地。此前使用 MongoDB 存储时序数据,但随着设备测点增加,MongoDB 在存储效率、写入性能、查询性能等方面暴露出短板。经过对比,沃太能源选择了专业时序数据库 TDengine,生产效能显著提升:整体上,数据压缩率超 10 倍、写入性能提升 18 倍,查询在特定场景上也实现了数倍的提升。同时减少了技术架构复杂度,实现了零代码数据接入。本文将对 TDengine 在沃太能源的应用情况进行详解。
47 0

热门文章

最新文章