mediawiki에 BLOB 말고

MEDIUMBLOB 이라는게 있어서 용량을 찾아 보니.. 2^24?

2^24 = 16777216 = 16MB

위키 문서 길이 치고는 너무 긴거 아닌가 싶기도 하고?


[링크 : http://dev.mysql.com/doc/refman/5.5/en/storage-requirements.html]

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

mysql 트랜잭션  (0) 2017.01.12
mysql blob - binary large object  (0) 2017.01.12
mysql 다대다 관계  (0) 2017.01.04
mysql 인덱스와 db설계 실무 팁(?)  (0) 2017.01.04
mysql datetime과 timestamp 차이점  (0) 2017.01.04
Posted by 구차니
프로그램 사용/apache2017. 1. 10. 13:55

mod_throttle은 대충 찾아 보니 Apache 1.x 꺼고

mod_cband는 apache 2.x 용인듯


그래서 대세(!?)는 mod_cband


[링크 : https://sourceforge.net/projects/cband/]

[링크 : http://serverfault.com/questions/30149/alternative-to-mod-throttle]

Posted by 구차니
프로그램 사용/wiki2017. 1. 10. 10:04

다국어 하면서 먼가 db 쪽 변화가 큰가 보네..


[링크 : https://www.mediawiki.org/wiki/Multilingual_MediaWiki]

[링크 : https://www.mediawiki.org/wiki/Extension:Translate]

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

mediawiki sql debug dump  (0) 2017.06.16
mediawiki 데이터 구조 - page / revision  (0) 2017.01.16
mediawiki 1.28.0과 Xcache  (0) 2017.01.09
mediawiki extension - deletehistory  (0) 2015.11.04
google Analystics extension  (0) 2015.06.25
Posted by 구차니
프로그램 사용/wiki2017. 1. 9. 14:55

미디어위키 db구조 보려고 하는데

어라 설치중이라 로고가 다른가? ㅋ


아무튼 설치하려는데 개체 캐싱을 활성화 못하다는 에러와

유니코드 정규화 어쩌구 하길래 삽질을 해보니

두개 패키지를 설치하면 되는 듯 하다.

$ sudo apt-get install xcache php5-intl  



+

Xcache의 영향인가..


LocalSetting.php 에서 CACHE_ACCEL을 CACHE_ANYTHING로 바꾸어주면 로그인은 된다..

다만, 로그인 이미되어 있다고 이상 작동을 할뿐?

 69 ## Shared memory settings

 70 #$wgMainCacheType = CACHE_ACCEL;

 71 $wgMainCacheType = CACHE_ANYTHING;

 72 $wgMemCachedServers = [];

[링크 : https://www.mediawiki.org/wiki/Manual:$wgSessionCacheType]

  [링크 : http://stackoverflow.com/.../cant-log-in-to-mediawiki-canceled-as-a-precaution-against-session-hijacking]


+ 테이블 전부가 UTF-8 encoding이라는데. 그거 영향인가?

[링크 : https://www.mediawiki.org/wiki/Manual:$wgDBmysql5]


일단 테이블 자체는 binary 정렬방식이고 user_name은 varbinary(255)


user_name은.. 16진수로 써있지만 Minimonk 로 첫자가 대문자로 입력되어 있다.


---

$ sudo apt-cache search xcache

php-horde-cache - Horde Caching API

php5-xcache - Fast, stable PHP opcode cacher 


$ sudo apt-get install php5-intl 

[링크 : https://ibeblog.com/2013/01/21/installing-pecl-intl-ubuntu-12-04/]


$ sudo apt-cache search pecl | grep -i pecl

dh-make-php - Creates Debian source packages for PHP PEAR and PECL extensions

dh-php5 - debhelper add-on to handle PHP PECL extensions

libghc-byteable-dev - typeclass for byte sequences

libghc-byteable-doc - typeclass for byte sequences; documentation

libghc-byteable-prof - typeclass for byte sequences; profiling libraries

libghc-chunked-data-dev - typeclasses for dealing with various chunked data representations

libghc-chunked-data-doc - typeclasses for dealing with various chunked data representations; documentation

libghc-chunked-data-prof - typeclasses for dealing with various chunked data representations; profiling libraries

libghc-classy-prelude-dev - typeclass-based prelude

libghc-classy-prelude-doc - typeclass-based prelude; documentation

libghc-classy-prelude-prof - typeclass-based prelude; profiling libraries

libghc-convertible-dev - Typeclasses and instances for converting between types, GHC package

libghc-convertible-doc - Typeclasses and instances for converting between types, documentation

libghc-convertible-prof - Typeclasses and instances for converting between types, GHC profiling package

libghc-convertible-text-doc - typeclasses and instances for converting between types; documentation

libghc-mono-traversable-dev - typeclasses for mapping/folding/traversing monomorphic containers

libghc-mono-traversable-doc - typeclasses for mapping/folding/traversing monomorphic containers; documentation

libghc-mono-traversable-prof - typeclasses for mapping/folding/traversing monomorphic containers; profiling libraries

libghc-newtype-dev - A typeclass for working with newtypes

libghc-newtype-doc - A typeclass for working with newtypes; documentation

libghc-newtype-prof - A typeclass for working with newtypes; profiling libraries

libtarantool-php - PECL PHP driver for Tarantool/Box

php5-pecl-http - pecl_http module for PHP 5 Extended HTTP Support

php5-pecl-http-dev - pecl_http module for PHP 5 Extended HTTP Support development headers

php5-radius - PECL radius module for PHP 5

php5-remctl - PECL module for Kerberos-authenticated command execution 


$ sudo apt-get install php5-pecl-http php5-xcache

Reading package lists... Done

Building dependency tree

Reading state information... Done

The following extra packages will be installed:

  php-pear php5-propro php5-raphf

Suggested packages:

  php5-dev

The following NEW packages will be installed:

  php-pear php5-pecl-http php5-propro php5-raphf php5-xcache

0 upgraded, 5 newly installed, 0 to remove and 2 not upgraded.

Need to get 486 kB of archives.

After this operation, 2,712 kB of additional disk space will be used.

Do you want to continue? [Y/n] 


[링크 : https://www.liquidweb.com/kb/how-to-install-xcache-on-ubuntu-14-04-lts/]

Posted by 구차니

여기 문서를 참고해서 일단

가입 - 인증서 설치 - 로그인 - domain 인증 - 사이트 인증서 발급 함

[링크 : https://www.xetown.com/slope/135905]


발급과정에서 개인키 생성해서 웹에붙여 주어야 하는데 yourname.csr을 사용하고

개인키에 암호를 삭제한 yourname.nokey 파일을 생성

$ openssl req -newkey rsa:2048 -keyout yourname.key -out yourname.csr

Generating a 2048 bit RSA private key

.+++

.....................+++

writing new private key to 'yourname.key'

Enter PEM pass phrase:

Verifying - Enter PEM pass phrase:

-----

You are about to be asked to enter information that will be incorporated

into your certificate request.

What you are about to enter is what is called a Distinguished Name or a DN.

There are quite a few fields but you can leave some blank

For some fields there will be a default value,

If you enter '.', the field will be left blank.

-----

Country Name (2 letter code) [AU]:KR

State or Province Name (full name) [Some-State]:

Locality Name (eg, city) []:

Organization Name (eg, company) [Internet Widgits Pty Ltd]:

Organizational Unit Name (eg, section) []:

Common Name (e.g. server FQDN or YOUR name) []:

Email Address []:


Please enter the following 'extra' attributes

to be sent with your certificate request

A challenge password []:

An optional company name []:


그리고는 키를 없애고 키 저장소로 복사!

$ openssl rsa -in yourname.key -out yourname.nokey

Enter pass phrase for yourname.key:

writing RSA key

$ sudo cp yourname.nokey /etc/ssl/private/yourname.nokey 

[링크 : http://blog.acu.pe.kr/55]


그러면 zip파일로 다운받을 수 있는데

apache를 쓰고 있으니 해당 파일을 압축 풀어 /etc/ssl/certs 에 넣어 주었다.

$ unzip minimonk.net.zip

$ unzip ApacheServer.zip

$ sudo cp *.crt /etc/ssl/certs


일단 공식사이트에서는 이렇게 하라는데

SSLCertificateFile "/usr/local/apache2/conf/2_your_domain.crt"

SSLCertificateKeyFile "/usr/local/apache2/conf/private.key"

SSLCertificateChainFile "/usr/local/apache2/conf/1_root_bundle.crt" 

[링크 : https://www.startssl.com/Support?v=21]


나의 경우에는 이런식으로 설정

$ sudo vi /etc/apache2/sites-available/default-ssl.conf 

                SSLCertificateFile /etc/ssl/certs/2_your_domain.crt

                SSLCertificateKeyFile /etc/ssl/private/yourname.nokey

                SSLCertificateChainFile /etc/ssl/certs/1_root_bundle.crt


아무튼 라즈베리 키로 할때는 안전하지 않음이라고 크롬에서 뜨는데

starssl 에서 적용하니 이제 안전함! 우오오옹

class 1이라 그런가

은행권 처럼 녹색으로 줄이 쫙! 그이진 않네


---

처음 하라는대로 해보니 되긴한데 암호 넣으라고 한다. ㅠㅠ

그래서 키삭제 하는게 서비스 유지에는 편리!

$ sudo service apache2 restart

Enter passphrase for SSL/TLS keys for 127.0.1.1:443 (RSA): ******** 



어? 아이패드에서 (ios 10.2) 접속 자체를 안하는것 같다?!?!
[링크 : https://discussions.apple.com/thread/7791706?start=0&tstart=0]


Posted by 구차니

라즈베리 파이에서 매일매일 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 구차니