terracotta服务器启动是用bin目录下的start-tc-server.bat或start-tc-server.sh
可以用nohup:nohup sh start-tc-server.sh &
这种方式启动时加载默认的配置文件,在lib目录下tc.jar里面的/com/tc/config/schema/setup/default-config.xml
内容如下:
1: <?xml version="1.0" encoding="UTF-8" ?>
2: <!--
3:
4: All content copyright (c) 2003-2008 Terracotta, Inc., except as may
5: otherwise be noted in a separate copyright notice. All rights reserved
6: -->
7:
8: <!--
9: This config file is used by the server and bootjar tool when none is
10: specified.
11: -->
12:
13: <tc:tc-config xmlns:tc="http://www.terracotta.org/config">
14: <servers>
15: <server>
16: <data>%(user.home)/terracotta/server-data</data>
17: <logs>%(user.home)/terracotta/server-logs</logs>
18: <statistics>%(user.home)/terracotta/server-statistics</statistics>
19: </server>
20: </servers>
21:
22: <clients>
23: <logs>%(user.home)/terracotta/client-logs</logs>
24: <statistics>%(user.home)/terracotta/client-statistics</statistics>
25: </clients>
26: </tc:tc-config>
27:
28:
也可以加载指定的配置文件,如果将自己的配置文件放在bin目录下且命名为tc-config.xml,启动时自动加载该配置。如果放在其他位置,可以用-f参数指定:
sh start-tc-server.sh -f /root/tc-config.xml
因一台机器可能有多个网卡或host,也可以配置多个server:
1: <?xml version="1.0" encoding="UTF-8" ?>
2: <!--
3:
4: All content copyright (c) 2003-2008 Terracotta, Inc.,
5: except as may otherwise be noted in a separate copyright notice.
6: All rights reserved
7:
8: -->
9:
10: <!-- This config file is used by the server and bootjar tool when none is specified. -->
11:
12: <tc:tc-config xmlns:tc="http://www.terracotta.org/config">
13: <servers>
14: <server host="123.456.789.121">
15: <data>%(user.home)/terracotta/server-data</data>
16: <logs>%(user.home)/terracotta/server-logs</logs>
17: <statistics>%(user.home)/terracotta/server-statistics</statistics>
18: </server>
19: <server host="192.168.0.121">
20: <data>%(user.home)/terracotta/server-data</data>
21: <logs>%(user.home)/terracotta/server-logs</logs>
22: <statistics>%(user.home)/terracotta/server-statistics</statistics>
23: </server>
24: </servers>
25:
26: <clients>
27: <logs>%(user.home)/terracotta/client-logs</logs>
28: <statistics>%(user.home)/terracotta/client-statistics</statistics>
29: </clients>
30: </tc:tc-config>
31:
启动时可以指定某个server:sh start-tc-server.sh -f /root/tc-config.xml -n LAN,如果没指定则启动所有的。
这样指定了具体的IP,用dev-console查看远程共享数据时Mirror group就不会一直是127.0.0.1了。