라즈베리 파이에서 매일매일 logrotate 하도록 하고

webalizer는 access.log.1 을 보도록 되어 있어서

logrotate를 안돌리면 webalizer 쪽이 갱신되지 않는 문제가 있다.


아무튼 몇일되는 바람에 .3 까지 생겨서

이렇게 하나로 묶어주고 실행해서 업데이트!

$ sudo su -

# cd /var/log/apache2

# cat access.log.3 access.log.2 access.log.1 access.log > access.log.all 

# rm access.log

# mv access.log.all access.log

# vi /etc/webalizer/webalizer.conf

LogFile /var/log/apache2/access.log

# webalizer


Posted by 구차니

예전 db 수업 시간에 들은거 같은데

결론은.. 다대다 관계를 지원하더라도 되도록이면 DB정규화를 통해

1:N이나 N:1으로 다대다 관계를 풀어서 쓰도록


[링크 : http://loopypapa.tistory.com/entry/SQL-일대일-일대다-다대다-관계]

[링크 : http://www.taeyo.net/Forum/Content.aspx?SEQ=22495&TBL=SQL&PGN=1330]

Posted by 구차니

외래키는 어떻게 보면.. 자동으로 연관항목 삭제시 같이 삭제하도록 하는 "자동화"에 가까운 느낌

삭제가 아니더라도 null 값으로 바꾼다던가 하는 일종의 trigger라고 해야하나?

[링크 : http://zetawiki.com/wiki/MySQL_외래키_생성]

[링크 : http://cloudless.tistory.com/49]


MyISAM DB 타입일 경우 도움 외래키 지원을 안해서 그걸 지원해주는 용도라니까.. 딱히 안써도 될 듯

[링크 : http://stackoverflow.com/.../difference-between-mysql-foreign-key-and-internal-relation]


[링크 : http://stackoverflow.com/.../what-are-the-internal-relations-defined-in-phpmyadmin]

[링크 : http://stackoverflow.com/.../what-do-internal-relations-do-in-phpmyadmin-for-myisam-tables]


db 타입이 MyISAM 일 경우에는 외래키를 지원하지 않고, InnoDB로 해야지 지원을 하게 된다.

[링크 : http://ojava.tistory.com/25]

[링크 : http://codeigniter-kr.org/bbs/view/tip?idx=8348]


[링크 : http://egloos.zum.com/mcchae/v/10625121]

[링크 : http://jason-heo.github.io/mysql/2014/03/05/mysql-foreign-key.html]

Posted by 구차니

phpmyadmin 에서 인덱스가 없습니다! 하나 생성하세요.

라고 하길래 봤는데.. 이거 막 새엇ㅇ하면 안되겠꾸만


인덱스 생성시 느리고, select시 성능향상을 줌

[링크 : http://ra2kstar.tistory.com/96]


oracle과 차이점

[링크 : http://gywn.net/2012/05/mysql-bad-sql-type/]


null 대신 not null(그래서 기본값이 not null 이었나..)

[링크 : http://egloos.zum.com/tiger5net/v/5660848]


https://blog.lael.be/post/370

'프로그램 사용 > mysql & mariaDB' 카테고리의 다른 글

mysql 변수별 사이즈  (0) 2017.01.12
mysql 다대다 관계  (0) 2017.01.04
mysql datetime과 timestamp 차이점  (0) 2017.01.04
mysqldump 복구시 TYPE=MyISAM 오류  (0) 2016.10.06
woobi mysql 백업복구  (0) 2015.03.02
Posted by 구차니

phpmyadmin에서 작업을 하는데

Null no가 떠서 먼가 하고 보는 중인데..

mysql client에서 보면.. Null 은 no 똑같네?

mysql> desc archlog_useraccount;l

+----------------+-------------+------+-----+---------+----------------+

| Field          | Type        | Null | Key | Default | Extra          |

+----------------+-------------+------+-----+---------+----------------+

| idx            | int(11)     | NO   | PRI | NULL    | auto_increment |

| time_create    | datetime    | NO   |     | NULL    |                |

| time_lastlogin | datetime    | NO   |     | NULL    |                |

| time_lastmodi  | datetime    | NO   |     | NULL    |                |

| userid         | char(50)    | NO   |     | NULL    |                |

| passwd         | char(72)    | NO   |     | NULL    |                |

| passwd_plain   | char(12)    | NO   |     | NULL    |                |

| username       | varchar(30) | NO   |     | NULL    |                |

| birth          | datetime    | NO   |     | NULL    |                |

+----------------+-------------+------+-----+---------+----------------+

9 rows in set (0.01 sec)


아무튼.. 덤프해서 보면 alter로 속성값 바꾸듯 해두었는데

CREATE TABLE IF NOT EXISTS `archlog_useraccount` (

`idx` int(11) NOT NULL,

  `time_create` datetime NOT NULL,

  `time_lastlogin` datetime NOT NULL,

  `time_lastmodi` datetime NOT NULL,

  `userid` char(50) NOT NULL,

  `passwd` char(72) NOT NULL,

  `passwd_plain` char(12) NOT NULL,

  `username` varchar(30) NOT NULL,

  `birth` datetime NOT NULL

) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 COMMENT='user account table';


ALTER TABLE `archlog_useraccount`

 ADD PRIMARY KEY (`idx`), ADD UNIQUE KEY `idx` (`idx`,`userid`);


ALTER TABLE `archlog_useraccount`

MODIFY `idx` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=2;


예제를 보면 이런식으로 생성시에 넣을수 있는 듯

CREATE TABLE animals (

    grp ENUM('fish','mammal','bird') NOT NULL,

    id MEDIUMINT NOT NULL AUTO_INCREMENT,

    name CHAR(30) NOT NULL,

    PRIMARY KEY (grp,id)

) ENGINE=MyISAM; 


[링크 : http://dev.mysql.com/doc/refman/5.7/en/example-auto-increment.html]



그리고 null / no는 not null이 맞는 듯

그런데 pri키로서 idx는 null이 넣어도 에러 안나던데 !!?


자세히 보니.. NULL은 아니고 ''로 빈 문자열을 넣어 버렸네 -_-


Posted by 구차니

mysql 5.7 메뉴얼인데.. 1970 epoch 기준으로 timestamp를 사용되는데 32bit 인가..

mysql 64bit면 더 길게 저장이 되려나?



아무튼 차이점은 timestamp는 UTC + epoch(2038년 문제 발생)

datetime은 9999년까지 가능


The DATETIME type is used for values that contain both date and time parts. MySQL retrieves and displays DATETIME values in 'YYYY-MM-DD HH:MM:SS' format. The supported range is '1000-01-01 00:00:00' to '9999-12-31 23:59:59'.


The TIMESTAMP data type is used for values that contain both date and time parts. TIMESTAMP has a range of '1970-01-01 00:00:01' UTC to '2038-01-19 03:14:07' UTC

[링크 : http://dev.mysql.com/doc/refman/5.7/en/datetime.html]


8바이트 먹지만 DATETIME형을 쓰는게 2038 문제 회피에 유리하다 인가?

[링크 : http://stackoverflow.com/questions/2012589/php-mysql-year-2038-bug-what-is-it-how-to-solve-it]


[링크 : http://mysqldba.tistory.com/268]

[링크 : http://blog.naver.com/gigar/60115731039]

[링크 : http://linux.systemv.pe.kr/timestamp-datetime-기능-개선/]


DATETIME에는 NOW() 함수로 현재 시간을 넣어 줄 수 있네

[링크 : http://jsonobject.tistory.com/122]

Posted by 구차니
프로그램 사용/vi2017. 1. 3. 11:53

'프로그램 사용 > vi' 카테고리의 다른 글

vi 현재 위치에서 끝까지 복사  (0) 2017.02.01
vi 단어 단위 이동  (0) 2017.02.01
vimdiff 사용법  (0) 2016.11.17
vi 스크롤  (0) 2016.11.10
vi ctrl-s / ctrl-q  (0) 2016.11.09
Posted by 구차니

단종된게 대개 그렇지만, 보안상의 이유로 더 이상 유지하지 않기로..

[링크 : http://blog.learningtree.com/rhel-7-new-features-samba-4-changes/]


요건 다 예전 문서가 되어버리네.

[링크 : https://help.ubuntu.com/community/Swat]

[링크 : https://www.samba.org/samba/docs/man/Samba-HOWTO-Collection/SWAT.html]

Posted by 구차니
프로그램 사용/gcc2017. 1. 2. 15:14

'프로그램 사용 > gcc' 카테고리의 다른 글

문자열에 escape 로 특수문자 넣기  (0) 2017.06.19
gcc cpp type (유니코드 문자열)  (0) 2017.04.04
gcc make CFLAGS=-D 관련  (0) 2016.11.17
gcc -fPIC  (0) 2016.06.22
gcc dependency .d 파일?  (0) 2016.03.28
Posted by 구차니
프로그램 사용/aws2017. 1. 2. 11:50

Function as a Service

msec 단위과금


장점으로는 딱 서비스에 집중하고 서버 구성이나 운영은 전혀 고민할 필요없다. 정도?



[링크 : http://www.zdnet.co.kr/column/column_view.asp?artice_id=20160614172904]

[링크 : http://blog.aliencube.org/ko/2016/06/23/serverless-architectures/]

[링크 : https://aws.amazon.com/ko/blogs/korea/serverless-architecture-by-korean-developers/]

'프로그램 사용 > aws' 카테고리의 다른 글

aws EC2 요금제  (0) 2024.05.10
aws 스토리지  (0) 2024.05.06
aws 리전별 가격비교  (0) 2024.05.06
aws vpc  (0) 2024.05.06
아마존 AWS 가입  (0) 2024.04.22
Posted by 구차니