
DROP TABLE IF EXISTS sys_sequence ; CREATE TABLE sys_sequence ( seq_name VARCHAR (50) NOT NULL, curr_value BIGINT NOT NULL DEFAULT 0, increment_by INT NOT NULL DEFAULT 1, PRIMARY KEY (seq_name) ) ENGINE = INNODB ; INSERT INTO sys_sequence VALUES ('SEQ_TEST_NO',10000,1); DELIMITER $$ DROP FUNCTION IF EXISTS currval $$ CREATE /*[DEFINER = { user | CURRENT_USER }]*/ FUNCTION currval(v_seq_name VARCHAR (50)) RETURNS BIGINT /*LANGUAGE SQL | [NOT] DETERMINISTIC | { CONTAINS SQL | NO SQL | READS SQL DATA | MODIFIES SQL DATA } | SQL SECURITY { DEFINER | INVOKER } | COMMENT 'string'*/ BEGIN DECLARE v_currval BIGINT; SET v_currval = 1 ; SELECT curr_value INTO v_currval FROM sys_sequence WHERE seq_name = v_seq_name ; RETURN v_currval ; END$$ DELIMITER ; -- SELECT `currval`('SEQ_TEST_NO'); DELIMITER $$ DROP FUNCTION IF EXISTS `nextval` $$ CREATE FUNCTION `nextval` (`v_seq_name` VARCHAR (50)) RETURNS BIGINT (20) CONTAINS SQL BEGIN UPDATE sys_sequence SET `curr_value` = last_insert_id(`curr_value` + `increment_by`) WHERE `seq_name` = v_seq_name ; RETURN last_insert_id(); END $$ DELIMITER ;
最近发现centos7 的/etc/rc.local不会开机执行,于是认真看了下/etc/rc.local文件内容的就发现了问题的原因了 #!/bin/bash # THIS FILE IS ADDED FOR COMPATIBILITY PURPOSES # # It is highly advisable to create own systemd services or udev rules # to run scripts during boot instead of using this file. # # In constrast to previous versions due to parallel execution during boot # this script will NOT be run after all other services. # # Please note that you must run 'chmod +x /etc/rc.d/rc.local' to ensure # that this script will be executed during boot. 翻译: #这个文件是为了兼容性的问题而添加的。 # #强烈建议创建自己的systemd服务或udev规则来在开机时运行脚本而不是使用这个文件。 # #与以前的版本引导时并行执行相比较,这个脚本将不会在其他所有的服务后执行。 # #请记住,你必须执行“chmod +x /etc/rc.d/rc.local”来确保确保这个脚本在引导时执行。 于是我有确认了下/etc/rc.local的权限 [root@localhost ~]# ll /etc/rc.local lrwxrwxrwx. 1 root root 13 8月 12 06:09 /etc/rc.local -> rc.d/rc.local [root@localhost ~]# ll /etc/rc.d/rc.local -rw-r--r--. 1 root root 477 6月 10 13:35 /etc/rc.d/rc.local /etc/rc.d/rc.local没有执行权限,于是按说明的内容执行 chmod +x /etc/rc.d/rc.local 重启后发现/etc/rc.local能够执行了。 看样子是版本的变迁,/etc/rc.local /etc/rc.d/rc.local正弃用的路上。
1.yum – y install git 安装git,git作为一个 分布式代码仓库,其实没有server和client的概念,每个机器上保存的都是一份完整的代码库,不过貌似是大团队的话,为了管理方便,会在服务器装一个管理的东东,俺是小团队,有需要再去研究,小团队手动就口以了 安装git 2.创建一个裸仓库 cd srv mkdir git cd git git –init bare project.git 3.创建一个git用户,git登陆上传走的貌似好像就是ssh,所以要创建一个用户 useradd git passwd git 4.然后把project.git文件夹赋予git用户 chown -R git:git project.git 创建git裸仓库 至此,服务器端的git搭建就已经完毕鸟,,, 在另一台机器上clone这个空代码库,然后添加文件,再push到服务器 1.进入git bash,我这个windows下个git已经安装配置完成了,所以直接clone,192.168.153.129为我centos7的ip git clone git@192.168.153.129:/srv/git/project.git 2.输入git的密码 3.进入project.git cd project.git 4.创建一个测试文件 vim test.txt 随便写一些内容 5.查看状态 git status 看到有一个待添加的文件texs.txt了 6.添加test.txt让git追踪 git add test.txt 7.提交到版本库,并写上备注信息 git commit test.txt -m ‘just a test’ 8.把他推送到服务器的版本库中去 git push origin master git client git commit 已经推送到服务器端区了。。。接下来去服务器端看看有木有 刚才俺们在服务器端创建版本库时用的是 git init –bare project.git 加了个–bare就是创建一个裸仓库,没有工作区哒,所以这里只记录了文件的改动,要看是不是同步过来了,需要在git clone一次,看是不是这一次有test.txt啦 git git clone git@127.0.0.1:/srv/git/project.git,输入密码后,开始下载代码了,果然master分支已经有test.txt啦,git log查看一下提交记录,在mon feb 2 09:47:46 2015 +0800的这个,邮件为xxx的作者xxx提交哒。因为windows客户端配置的git是偶滴工作邮件和姓名,就打码了,ok,私有git搭建完成。
安装双系统以后,发现进入win7和ubuntu系统以后,显示的时间不一致,后来发现是两个系统对硬件时间的看法不一致 1、Windows会认为BIOS时间就是你的本地时间 2、ubuntu默认时间是把BIOS时间当成GMT+0时间,也就是世界标准时,而我国在东八区(GMT+8),所以如果你的Ubuntu位置是中国的话你系统显示的时间就是BIOS时间+8小时。假如现在是早上8点,那么你Ubuntu会显示8点,这时BIOS中的时间是0点。 更正方法:将ubuntu对待bios时间的方法改为和windows一致。 代码: sudo timedatectl set-local-rtc 1 代码: $ timedatectl Local time: 六 2016-04-23 09:05:54 CST Universal time: 六 2016-04-23 01:05:54 UTC RTC time: 六 2016-04-23 09:05:54 Time zone: Asia/Shanghai (CST, +0800) Network time on: yes NTP synchronized: no RTC in local TZ: yes Warning: The system is configured to read the RTC time in the local time zone. This mode can not be fully supported. It will create various problems with time zone changes and daylight saving time adjustments. The RTC time is never updated, it relies on external facilities to maintain it. If at all possible, use RTC in UTC by calling 'timedatectl set-local-rtc 0'.
2017/4/21 16:45:19 127.0.0.1:6379> info memory # Memory used_memory:1523016 Redis使用的内存总量used_memory_human:1.45M 上面参数换算成方便人读的(就是used_memory/1024/1024) used_memory_rss:2674688 从操作系统上显示已经分配的内存总量。 used_memory_peak:9452440 过去Redis内存使用的峰值used_memory_peak_human:9.01M 上面参数换算成方便人读的(就是used_memory_peak/1024/1024) used_memory_lua:36864 mem_fragmentation_ratio:1.76 内存碎片率。 mem_allocator:jemalloc-3.6.0 在编译时指定的Redis使用的内存分配器,可以是libc、jemalloc、tcmalloc。