热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

mopupterminalreplay

RemoteDB1.Createatablethatrecordthestartandendtimeofaproject.Theformat:projectIDstartTim

 

RemoteDB

1. Create a table that record the start and end time of a project. The format:

projectID  startTime  endTime

Now we can get these 2 times by desc and asc, we can do this after apparently define project_id.

2. Define the format of logs, create a final-log-table in remoteDB, which contains the results of select of kinds of monitor tables. This is becausec command mysqldump cannot only export dedicated columns, the parameter where can only filter lines, resulting we can only get final-log from a result table and filter it with time range.

We can do this after define the format of final-log of terminal.

 

Frontends

1. When import into exclusiveDB, add a column called ifchecked, true means this log is searched once and has displayed in the webpage, it cannot be search out again. So we must set the ifchecked column corresponding to search results to true.

Error: Using command cur.execute("update filesysteminfo set ifchecked = %s" % initialval), but the value of ifchecked is null not 0, although print the command is "update filesysteminfo set ifchecked = 0"

Solution: After the above cur.execute, you have to run "conn.commit()", conn is the the object got from MySQLdb.connct(..). This commit all changes that you load into MySQL server. You could also use this approach to enable the auto commit setting, just after the MySQL connection initialization: dbb.autocommit(True)

 

2. Verify the order of columns when search exclusiveDB.

3. Modify usage of datatime.replace. When using replace(day=day+1), if day is 23 initially, it'll be 24 and out of hour range 0~23, resulting in an error.

The order of parameter is: timedelta([days[, seconds[, microseconds[, milliseconds[, minutes[, hours[, weeks]]]]]]]), and return an datetime object.

 

from datetime import timedelta

timespan=timedelta(days=1)

curdatetime=nowdatetime+timespan

4. Scroll


  
实时信息

  

    

          {#
  • 开始检测实时信息
  • #}
        

  

5. flush in order with 1s interval,

I write this in setTimeout and different record has different delay time.

 

var sttr="

  • ";
    for ( var subcolum in result.content[i])
      sttr=sttr + " " + result.content[i][subcolum];
    $(sttr + "
  • ").prependTo(ul);

    But the console.log output of "console.log(sttr+"")" is "

  • ", and "console.log(i)" is 19, which is out of range (the true tag is 0~18). So we must set i as an parameter of setTimeout function.

    Finally we use methods of array in Javascript push() and shift(), putting the value of each log record into the array.

    push() will add one or more kinds of objects into the end of an array, and return the length of the array. The opposite method pop() will pop object from end of an array, those two can realize function as stack.

    arrayObject.push(newelement1,newelement2,....,newelementX)

    shift() will delete and return the value of first object in the array.

    arrayObject.shift()

     6. Change the offlineproc time to now(), and push to apache.

    push project to git repository:

    fetch project from git repository:

     restart apache2

     the dashboard pc can connect to storage cluster and git server but cannot connect to db of yan.

    sudo a2ensite 000-default  // but the code is not the latest fetch from repository.

    汉化:

    ./manage.py makemessages

    ./manage.py compilemessages

    server启动:

    git pull origin master

    rm -rf static/

    source dashboardenv/bin/activate

    ./manage.py collectstatic

    deactivate

    sudo service apache2 restart

    grant all on *.* to 'helen'@'192.168.101.72' identified by '123321';

    helen'@'192.168.228.9

    mysql -h192.168.101.71 -P3306 -uhelen -p123321 importdb

    mysql -unsr -pnsr1234 HostMonitorData  <./latest.sql

    安装python-rados成功&#xff0c;开始不行&#xff0c;报错“Unable to locate package”&#xff0c;比较ubuntu16.04 &#xff08;成功用apt安装python-rados&#xff09;和ubuntu14.04的/etc/apt/sources.list&#xff0c;发现16.04的源的url几乎都以cn打头&#xff0c;14.04是en打头&#xff0c;所以

    16.04&#xff1a;

    14.04&#xff1a;

    用16.04的/etc/apt/sources.list替换14.04&#xff0c;"sudo apt update"更新软件源&#xff0c;再次“sudo apt install python-rados”即可安装成功&#xff0c;既可以执行python2编写的操作存储集群的脚本&#xff0c;至此只有周期性执行download这一条没有测试通过&#xff1a;

     display server上无法操作存储集群&#xff0c;能够正确拼接python2脚本路径&#xff0c;此时python2脚本中写的绝对路径&#xff1a;

    通过tail -f /var/log/apache2/error.log看到错误为访问权限&#xff1a;

    这几个文件的权限与虚拟机上权限相同&#xff1a;

    如果python2脚本中写相对路径&#xff1a;

    报错没找到相应log文件&#xff0c;路径错误&#xff0c;用os.getcwd()取得路径是/var/www;

    这是apache执行的根目录&#xff0c;存放静态文件&#xff1a;

    不能使用django的BASE_DIR&#xff1a;

    会有一连串的问题&#xff1a;

    所以最简单方法使用绝对路径&#xff0c;添加root的写权限&#xff1a;

     

     修改权限后还是有错误&#xff1a;

     从ceph_error.log可以看到对import目录没有写权限&#xff1a;

    下面添加写权限&#xff1a;

     

     

    在git中如果想忽略掉某个文件&#xff0c;不让这个文件提交到版本库中&#xff0c;可以使用修改根目录中 .gitignore 文件的方法&#xff08;如无&#xff0c;则需自己手工建立此文件&#xff09;。这个文件每一行保存了一个匹配的规则例如&#xff1a;

    ?
    1
    2
    3
    4
    5
    6
    7
    # 此为注释 – 将被 Git 忽略
    *.a       # 忽略所有 .a 结尾的文件
    !lib.a    # 但 lib.a 除外
    /TODO     # 仅仅忽略项目根目录下的 TODO 文件&#xff0c;不包括 subdir/TODO
    build/    # 忽略 build/ 目录下的所有文件
    doc/*.txt # 会忽略 doc/notes.txt 但不包括 doc/server/arch.txt

    规则很简单&#xff0c;不做过多解释&#xff0c;但是有时候在项目开发过程中&#xff0c;突然心血来潮想把某些目录或文件加入忽略规则&#xff0c;按照上述方法定义后发现并未生效&#xff0c;原因是.gitignore只能忽略那些原来没有被track的文件&#xff0c;如果某些文件已经被纳入了版本管理中&#xff0c;则修改.gitignore是无效的。那么解决方法就是先把本地缓存删除&#xff08;改变成未track状态&#xff09;&#xff0c;然后再提交&#xff1a;

    ?
    1
    2
    3
    git rm -r --cached .
    git add .
    git commit -m &#39;update .gitignore&#39;

     Today‘s Tasks&#xff1a;

     apache django

    deamon service

    ht

    转:https://www.cnblogs.com/helenbj/p/7448561.html



    推荐阅读
    author-avatar
    秋日里的一抹阳光_797
    这个家伙很懒,什么也没留下!
    PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
    Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有