2013/12/16

mysql Increasing the Size of the InnoDB Tablespace


  The easiest way to increase the size of the InnoDB tablespace is to configure it from the beginning to be auto-extending. Specify the autoextend attribute for the last data file in the tablespace definition. Then InnoDB increases the size of that file automatically in 8MB increments when it runs out of space. The increment size can be changed by setting the value of the innodb_autoextend_increment system variable, which is measured in MB.

You can expand the system tablespace by a defined amount by adding another data file:

    Shut down the MySQL server.

    If the previous last data file is defined with the keyword autoextend, change its definition to use a fixed size, based on how large it has actually grown. Check the size of the data file, round it down to the closest multiple of 1024 × 1024 bytes (= 1MB), and specify this rounded size explicitly in innodb_data_file_path.

    Add a new data file to the end of innodb_data_file_path, optionally making that file auto-extending. Only the last data file in the innodb_data_file_path can be specified as auto-extending.

    Start the MySQL server again.

For example, this tablespace has just one auto-extending data file ibdata1:

innodb_data_home_dir =
innodb_data_file_path = /ibdata/ibdata1:10M:autoextend

Suppose that this data file, over time, has grown to 988MB. Here is the configuration line after modifying the original data file to not be auto-extending and adding another auto-extending data file:

innodb_data_home_dir =
innodb_data_file_path = /ibdata/ibdata1:988M;/disk2/ibdata2:50M:autoextend

When you add a new file to the tablespace configuration, make sure that it does not exist. InnoDB will create and initialize the file when you restart the server.

2013/12/02

bash data format

1970/01/01 00:00:00 からの経過秒%s
年(西暦4桁)%Y
年(西暦下2桁)%y
月(01~12)%m
月(Jan~Dec)%b
月(January~December)%B
日(01~31)%d
日( 1~31) ※空白含む2桁%e
曜日(Sun~Sat)%a
曜日(Sunday~Saturday)%A
曜日(0~6) ※0は日曜日%w
時(00~23)%H
時(01~12)%I
時( 0~23) ※空白を含む2桁%k
時( 1~12) ※空白を含む2桁%l
分(00~59)%M
秒(00~59)%S
AM/PM%p
am/pm%P
改行%n
フォーマットを指定して日時を表示するには、以下のようにパラメータを指定して date コマンドを実行する。
フォーマットコマンド
yyyy/mm/dddate '+%Y/%m/%d'
yyyy/mm/dd (Sun..Sat)date '+%Y/%m/%d(%a)'
yy/mm/dddate '+%y/%m/%d'
yyyy-mm-dddate '+%F'
mm/dd/yydate '+%D'
hh:mm (24時間制)date '+%R'
hh:mm:ss (24時間制)date '+%T'
hh:mm:ss AM|PM (12時間制)date '+%r'

2013/11/22

html文字化け対策 文字コード宣言

metaタグを使って宣言する


ISO-2022-JP(いわゆるJIS)

    <meta http-equiv="Content-Type" content="text/html; charset=iso-2022-jp">
Shift_JIS(WindowsやMacではこの文字コードがよく使われます)
    <meta http-equiv="Content-Type" content="text/html; charset=shift_jis">
EUC-JP(UNIX系OSではこの文字コードがよく使われます)
    <meta http-equiv="Content-Type" content="text/html; charset=euc-jp">
   
 ===>文字コードをShift_JISだと宣言しているのに別の文字コードで保存したりすると確実に文字化け

2013/11/21

linux size big file

$ du -k / | sort -n | tail -10
 
$ du -sh ***
   -s sum 文件夹整体大小
   - human  

java reflect constructor ect

★引数なし
Class<String> clazz = String.class;
String obj=clazz.newInstance();

★引数ある、Constructorを使う。配列も必要!
Class<Integer> clazz = Integer.class;
Class<?>[] types = { int.class };

Constructor<Integer> constructor= clazz.getConstructor(types);
Object[] args = { Integer.valueOf(123) };
Integer obj = constructor.newInstance(args);

★clazz = Class.forName("java.lang.String");

★ClassLoader!!!
ClassLoader loader = Thread.currentThread().getContextClassLoader();
ClassLoader loader = ClassLoader.getSystemClassLoader()
ClassLoader loader = URLClassLoader.newInstance(new URL[]{ new File("jarファイル").toURI().toURL() });
clazz = loader.loadClass("java.lang.String");

★method
Method method =  clazz.getMethod("メソッド名", null);
Object ret = method.invoke(null, null);

Method method =  clazz.getMethod("メソッド名", new Class[]{ int.class });
Object ret = method.invoke(object, new Object[]{ new Integer(1) });

★Field
Class c = obj.getClass();
Field f = c.getField("field");
f.set(obj, 123);

2013/11/20

Spring 定期タスク CronTriggerBean

「秒 分 時 日 月 曜日 年」
という順番で記述します。
記法例は、以下のとおり。

記述例 説明
0 0 * * * 数値を指定する。毎時0分0秒に起動
0 */30 * * * /を使用する。割り算をして余りがないときに起動。
左の場合、0分、30分。
0 10,15 * * * カンマ区切りで記述する。左の場合、毎時10分0秒、15分0秒に起動する。
0 0 0 1 * ? */2 ?を使用する。?は日と曜日に使用できますが、*とほぼ同じ意味です。ただ、年を指定する場合に曜日も指定しないといけなくなります。曜日を指定したくないのに*を記述すると毎日起動してしまいますので?で回避します。
左の例ですと、偶数年の毎月1日0時0分0秒に起動します。
0 10-15 * * * ハイフンで記述する。左の場合、毎時10分0秒、11分0秒、~15分0秒に起動する。

2013/11/19

bash seq

for x in a b c d e f g
do
echo $x
done


for a in $(seq 1 5)
do
echo $a
done


seqはfor i in 'seq 1 10' のように書いて、from〜toの値を順に+1して返す。
'seq 1 2 10'と書くと1〜10で増分+2を表す。

apaceh tomcat https

tomcatのserver.xml
<Listener className="org.apache.catalina.core.AprLifecycleListener" SSLEngine="on" />

Connector  port="8009"
           protocol="AJP/1.3"
           scheme="https"
           secure="true";
           />

apacheのrewriteでもできるのようです。。。

設定できる所、いろいろあり、困るね。