All the Interesting Things

This is a personal web log. All information posted here does not represent my employer. I do not speak for my employer.
Thursday May 28, 2009

3rd Article on Writing the JavaFX Pac-Man Game

The latest JavaFX article of writing the Pac-Man game is published today. It is the third out of a five-article series: "Writing the Pac-Man Game in JavaFX - Part 3".

In this article, the ghosts are introduced. The animation of the ghosts are almost the same as the Pac-Man character. It is basically moving a CustomNode and switching the images. There are three sets of images for the animation: normal, hollow and flashing. The moving algorithm of the ghosts is the heart of the code. In this article, for simplicity, a random moving algorithm is applied. A more complicated moving behavior of the ghosts will be introduced in Article 5. Click on the below image to try the program so far. The Pac-man and ghosts cannot eat each other even they meet in the maze.



Related Articles:

Pac-Man Game WidgetFX Widget
JavaFX Game Example Code: MineSweeper
JavaFX Game Demo Example: Pac-Man

Other links:

Applicant of American Citizenship Information, software and guide.
Guide American Citizenship in United States
Canadian Citizenship Application and Practice Exam
Haining Zhang

Thursday May 21, 2009

Second Article on Writing the JavaFX Pac-Man Game Published

The second article of a series, "Writing the Pac-Man Game in JavaFX - Part 2", is published today.

In the first article, I introduced a data model expressed in Java and the JavaFX drawing logic of the maze. In the 2nd article, the animation of the Pac-Man character is detailed. When you are reading, you can click on the java web start links to see the Pac-Man opening and closing mouths, and gradually moving inside the maze. The keyboard handling logic is introduced as well.

Some JavaFX features demostrated in these two articles include:

. shapes
. animation
. keyboard handling
. java code integration
. Transfromation

Hope you can enjoy reading the articles. You can use arrow keys to control the Pac-Man character to move around and gobble dots. Try the never-to-die version of the game by clicking the below screenshot:

click to run

click to run


Other Related Articles:
Develop Games in JavaFX
JavaFX Blogs: Tips, Tricks, Programming Sample Code
My JavaFX Demo Game: Pac-Man

Monday May 18, 2009

JavaFX Demo Program: Wish Tree

To give some fun to my kids, I wrote a small JavaFX program to let them make wishes on a wish tree( such as 'I want a Barbie'). If they do something good, they may be awarded a wish coming true. :)

This program uses effect classes of JavaFX API to create the scene. Colorful stars can be placed on the tree to stand for wishes. More details inlcluding source code of the program can be found here: JavaFX Wish Tree.

You can click on the below web start image to start placing your wishes on the tree now. Just click on the tree and enter your name and wishes. Enjoy! (JDK 1.5+, better with JDK 1.6 U10)

Click to start JavaFX Wish Tree

Click to start JavaFX Wish Tree

Click to start JavaFX Wish Tree



Other Posts of JavaFX:
Wish Tree in JavaFX
Writing the Pac-Man Game with JavaFX
JavaFX Game Sample Code
JavaFX例子、实例、编程和源程序
JavaFX Guy的技术、教程、博客
Haining Zhang

Saturday May 16, 2009

Five Articles on JavaFX Pac-Man Game

After I wrote a Pac-Man game using the JavaFX API, many people were quite interested in the game. They either enjoyed playing it or asked me for the details fo the JavaFX code. JavaFX expert Jim Weaver invited me to write some articles about the process of building the game. After a few weeks' hard work, with Jim's constructive ideas and great help in proofreading, I finished the articles. Now they are published on insideRIA.com, an O'Reilly's web site, as featured articles. There will be 5 articles in total and they will run through the coming 5 weeks.

In each article, there are a few web start links that you can click on and start a JavaFX program to see how it works. If you follow the 5 articles, you will find out how the game is built bit by bit. I hope the articles can help people who want to learn JavaFX or want to develop games in JavaFX.

Here is the links for the articles:

May 14, 2009: Writing the Pac-Man Game in JavaFX - Part 1
May 21, 2009: Writing the Pac-Man Game in JavaFX - Part 2
May 28, 2009: Writing the Pac-Man Game in JavaFX - Part 3
June 4, 2009: Writing the Pac-Man Game in JavaFX - Part 4
June 11, 2009: Writing the Pac-Man Game in JavaFX - Part 5

Related articles:
My JavaFX Demo Game: PACMAN
JavaFX Demo Game: PAC-MAN
JavaFX Game
JavaFX Wish Tree
JavaFX

Thursday May 14, 2009

My Articles on Writing the Pac-Man Game in JavaFX

After I wrote the Pac-Man game with JavaFX, many people were asking me to give more details on writing the game. JavaFX guru Jim Weaver had invited me to write some articles on the game. Now, with Jim's help, our articles are featured on O'Reilly's insiderRIA.com . Here is the link to the articles:

Writing the Pac-Man Game in JavaFX

Tuesday Apr 28, 2009

用容器实现Solaris的动态资源分配

本文介绍了在Solaris 10中如何运用虚拟化技术来实现动态CPU资源管理。首发于:用Container实现Solaris 10上的动态资源分配

关键字:Solaris 10, Container, 资源管理,resource management, CMT

Solaris 10中提供了一项强大的虚拟化技术:Container(容器),通过使用Container,我们可以在一个操作系统实例中虚拟出多个运行环境(Zone),每个Zone有自己的文件系统和网络地址,各个Zone中运行的应用互相不影响,从而实现应用级的隔离,并提高了安全性。如下图所示, 在一个Solaris 10 的操作系统中,划分了3个Container,分别运行App Server, Web Server和Database Server。

Container的使用非常简单,通常只需要5-10分钟的配置即可,所以Container的虚拟化技术得到了广泛的应用。

(转载请注明出处:Java,JavaFX,Solaris技术交流 JavaFX 交流中心)

资源管理的作用

在缺省的情况下,各个Container都可以看见物理机器上的所有CPU 和内存,也就是说物理机上的所有CPU和内存在各个Container中是共享的。在实际运用中,往往需要对各个Container使用的资源加以指定,以便确保一些关键应用的资源。另外一种场景是需要动态调节各个Container中的资源,例如,在月末做报表时,希望临时给数据库的Zone多分配一些CPU资源,在月末压力高峰之后,就可以恢复成原来的CPU资源。动态资源调整(Dynamic Reconfiguration)的功能在中高端服务器上(如E25K,M4000-M9000等)可由硬件实现,在其他中低端类型的服务器中,我们可以用Container 来实现。

Container

Solaris 10 的Container 包括两层功能:Zone和Resource Management(RM)。Zone是指隔离的虚拟运行环境,RM是以前版本的Solaris就有的功能,可以结合Zone来动态分配资源。本文以T5220为例子加以说明,在实际中对所有运行Solaris10的多处理器机器都适用,包括X86机器。T5220 有一个UltraSPARC T2处理器,可以拥有8个核心(cores),每个核心有8个硬件线程,因此,T5220可以拥有64个硬件线程,在操作系统中可以看到有64个物理CPU,如

# psrinfo

0       on-line   since 04/08/2009 14:22:42
1       on-line   since 04/08/2009 14:22:45
2       on-line   since 04/08/2009 14:22:45
3       on-line   since 04/08/2009 14:22:45
4       on-line   since 04/08/2009 14:22:45
5       on-line   since 04/08/2009 14:22:45
6       on-line   since 04/08/2009 14:22:45

 ( 略去部分输出)

61      on-line   since 04/08/2009 14:22:45
62      on-line   since 04/08/2009 14:22:45
63      on-line   since 04/08/2009 14:22:45

创建Zone

1.创建Zone:

# mkdir –p /export/home/zones/zone1
# zonecfg -z zone1
zone1: No such zone configured
Use 'create' to begin configuring a new zone.
zonecfg:zone1>create 
zonecfg:zone1>set zonepath=/export/home/zones/zone1 
zonecfg:zone1>set autoboot=true    
zonecfg:zone1>add net
zonecfg:zone1:net>set address=192.168.0.1  
zonecfg:zone1:net>set physical=e1000g0      
zonecfg:zone1:net>end
zonecfg:zone1>verify
zonecfg:zone1>commit
zonecfg:zone1>exit


2. 查看配置的zone: 

# ls -l /etc/zones/*xml  可以看到zone1.xml的配置文件

# zoneadm list –cv 可以看到刚刚配置好的zone

3.安装zone:

# zoneadm –z zone1 install

4. 检查zone状态可以看到zone1 的状态为installed:

# zoneadm list –cv 

5. 启动zone:

# zoneadm –z zone1 boot

6.首次启动需要初始化服务和配置,可用命令登陆console监控:

# zlogin -C  zone1

7. 系统会出现配置界面,如主机名,命名服务等。完成配置后,zone会重新启动,
即可完成系统的启动。

8.如果在zone1里面运行psrinfo命令,可以看到64个CPU,也就是说,
global zone和local zone里面的CPU目前是共享的,下一步我们可以
把zone里的资源进一步限定。

(转载请注明出处:Java,JavaFX,Solaris技术交流 )

CPU资源分配

假定我们需要给这个zone分配8个CPU资源(即一个core),可以用以下资源管理命令:

1.先检查资源管理服务是否启用:

# svcs -a | grep pool
disabled       Jan_03   svc:/system/pools:default
disabled       Jan_03   svc:/system/pools/dynamic:default

如果显示disabled,则需要启用:

# svcadm enable pools
# svcadm enable pools/dynamic

# svcs -a | grep pool
online       Jan_03   svc:/system/pools:default
online       Jan_03   svc:/system/pools/dynamic:default


2. 启动资源管理功能和生成基本配置文件 :

# pooladm -e
# pooladm -s

3. 创建资源池(pool):

# poolcfg -dc ‘create pool pool1’

4. 创建CPU集(pset), 包括8个CPU,其中pset.min和pset.max限定了CPU的个数:

# poolcfg -dc ‘create pset pset1 ( uint pset.min=8; uint pset.max=8 )’

5. 指定特定的CPU到CPU集中,此步骤可选,如果不指定CPU编号,则系统自动分配CPU。
为了使T5220的分区具有较好的性能,我们把同一个core中的CPU分配到同一个CPU集中:

# poolcfg -dc ‘transfer to pset pset1 ( cpu 0; cpu 1; cpu 2; \
cpu 3; cpu 4; cpu 5; cpu 6; cpu 7)’

6.把资源池pool1和CPU集pset1作关联:

# poolcfg -dc ‘associate pool pool1 ( pset pset1 )’

7.保存配置到文件(save): 

# pooladm -s

Web Canadian Citizenship Test Interview
United States American Citizenship question
United States Citizen and Immigration Application

8.查看当前CPU资源的配置,可以看到pool1已经关联上pset1,
pset1中有8个CPU(id:0-7),而缺省的pset_default中只有56个CPU 了:

# pooladm

system default
        string  system.comment 
        int     system.version 1
        boolean system.bind-default true
        string  system.poold.objectives wt-load

        pool pool_default
                int     pool.sys_id 0
                boolean pool.active true
                boolean pool.default true
                int     pool.importance 1
                string  pool.comment 
                pset    pset_default

        pool pool1
                int     pool.sys_id 2
                boolean pool.active true
                boolean pool.default false
                int     pool.importance 1
                string  pool.comment 
                pset    pset1

        pset pset1
                int     pset.sys_id 1
                boolean pset.default false
                uint    pset.min 8
                uint    pset.max 8
                string  pset.units population
                uint    pset.load 0
                uint    pset.size 8
                string  pset.comment 

                cpu
                        int     cpu.sys_id 5
                        string  cpu.comment 
                        string  cpu.status on-line

                cpu
                        int     cpu.sys_id 4
                        string  cpu.comment 
                        string  cpu.status on-line

                cpu
                        int     cpu.sys_id 7
                        string  cpu.comment 
                        string  cpu.status on-line

                cpu
                        int     cpu.sys_id 6
                        string  cpu.comment 
                        string  cpu.status on-line

                cpu
                        int     cpu.sys_id 1
                        string  cpu.comment 
                        string  cpu.status on-line

                cpu
                        int     cpu.sys_id 0
                        string  cpu.comment 
                        string  cpu.status on-line

                cpu
                        int     cpu.sys_id 3
                        string  cpu.comment 
                        string  cpu.status on-line

                cpu
                        int     cpu.sys_id 2
                        string  cpu.comment 
                        string  cpu.status on-line

        pset pset_default
                int     pset.sys_id -1
                boolean pset.default true
                uint    pset.min 1
                uint    pset.max 65536
                string  pset.units population
                uint    pset.load 807
                uint    pset.size 56
                string  pset.comment 

                cpu
                        int     cpu.sys_id 13
                        string  cpu.comment 
                        string  cpu.status on-line

                cpu
                        int     cpu.sys_id 12
                        string  cpu.comment 
                        string  cpu.status on-line

                cpu
                        int     cpu.sys_id 15
                        string  cpu.comment 
                        string  cpu.status on-line

                cpu
                        int     cpu.sys_id 14
                        string  cpu.comment 
                        string  cpu.status on-line

                cpu
                        int     cpu.sys_id 9
                        string  cpu.comment 
                        string  cpu.status on-line

                cpu
                        int     cpu.sys_id 8
                        string  cpu.comment 
                        string  cpu.status on-line

                cpu
                        int     cpu.sys_id 11
                        string  cpu.comment 
                        string  cpu.status on-line

                cpu
                        int     cpu.sys_id 10
                        string  cpu.comment 
                        string  cpu.status on-line

                cpu
                        int     cpu.sys_id 21
                        string  cpu.comment 
                        string  cpu.status on-line

                cpu
                        int     cpu.sys_id 20
                        string  cpu.comment 
                        string  cpu.status on-line

                cpu
                        int     cpu.sys_id 23
                        string  cpu.comment 
                        string  cpu.status on-line

                cpu
                        int     cpu.sys_id 22
                        string  cpu.comment 
                        string  cpu.status on-line

                cpu
                        int     cpu.sys_id 17
                        string  cpu.comment 
                        string  cpu.status on-line

                cpu
                        int     cpu.sys_id 16
                        string  cpu.comment 
                        string  cpu.status on-line

                cpu
                        int     cpu.sys_id 19
                        string  cpu.comment 
                        string  cpu.status on-line

                cpu
                        int     cpu.sys_id 18
                        string  cpu.comment 
                        string  cpu.status on-line

                cpu
                        int     cpu.sys_id 29
                        string  cpu.comment 
                        string  cpu.status on-line

                cpu
                        int     cpu.sys_id 28
                        string  cpu.comment 
                        string  cpu.status on-line

                cpu
                        int     cpu.sys_id 31
                        string  cpu.comment 
                        string  cpu.status on-line

                cpu
                        int     cpu.sys_id 30
                        string  cpu.comment 
                        string  cpu.status on-line

                cpu
                        int     cpu.sys_id 25
                        string  cpu.comment 
                        string  cpu.status on-line

                cpu
                        int     cpu.sys_id 24
                        string  cpu.comment 
                        string  cpu.status on-line

                cpu
                        int     cpu.sys_id 27
                        string  cpu.comment 
                        string  cpu.status on-line

                cpu
                        int     cpu.sys_id 26
                        string  cpu.comment 
                        string  cpu.status on-line

                cpu
                        int     cpu.sys_id 53
                        string  cpu.comment 
                        string  cpu.status on-line

                cpu
                        int     cpu.sys_id 52
                        string  cpu.comment 
                        string  cpu.status on-line

                cpu
                        int     cpu.sys_id 55
                        string  cpu.comment 
                        string  cpu.status on-line

                cpu
                        int     cpu.sys_id 54
                        string  cpu.comment 
                        string  cpu.status on-line

                cpu
                        int     cpu.sys_id 49
                        string  cpu.comment 
                        string  cpu.status on-line

                cpu
                        int     cpu.sys_id 48
                        string  cpu.comment 
                        string  cpu.status on-line

                cpu
                        int     cpu.sys_id 51
                        string  cpu.comment 
                        string  cpu.status on-line

                cpu
                        int     cpu.sys_id 50
                        string  cpu.comment 
                        string  cpu.status on-line

                cpu
                        int     cpu.sys_id 61
                        string  cpu.comment 
                        string  cpu.status on-line

                cpu
                        int     cpu.sys_id 60
                        string  cpu.comment 
                        string  cpu.status on-line

                cpu
                        int     cpu.sys_id 63
                        string  cpu.comment 
                        string  cpu.status on-line

                cpu
                        int     cpu.sys_id 62
                        string  cpu.comment 
                        string  cpu.status on-line

                cpu
                        int     cpu.sys_id 57
                        string  cpu.comment 
                        string  cpu.status on-line

                cpu
                        int     cpu.sys_id 56
                        string  cpu.comment 
                        string  cpu.status on-line

                cpu
                        int     cpu.sys_id 59
                        string  cpu.comment 
                        string  cpu.status on-line

                cpu
                        int     cpu.sys_id 58
                        string  cpu.comment 
                        string  cpu.status on-line

                cpu
                        int     cpu.sys_id 37
                        string  cpu.comment 
                        string  cpu.status on-line

                cpu
                        int     cpu.sys_id 36
                        string  cpu.comment 
                        string  cpu.status on-line

                cpu
                        int     cpu.sys_id 39
                        string  cpu.comment 
                        string  cpu.status on-line

                cpu
                        int     cpu.sys_id 38
                        string  cpu.comment 
                        string  cpu.status on-line

                cpu
                        int     cpu.sys_id 33
                        string  cpu.comment 
                        string  cpu.status on-line

                cpu
                        int     cpu.sys_id 32
                        string  cpu.comment 
                        string  cpu.status on-line

                cpu
                        int     cpu.sys_id 35
                        string  cpu.comment 
                        string  cpu.status on-line

                cpu
                        int     cpu.sys_id 34
                        string  cpu.comment 
                        string  cpu.status on-line

                cpu
                        int     cpu.sys_id 45
                        string  cpu.comment 
                        string  cpu.status on-line

                cpu
                        int     cpu.sys_id 44
                        string  cpu.comment 
                        string  cpu.status on-line

                cpu
                        int     cpu.sys_id 47
                        string  cpu.comment 
                        string  cpu.status on-line

                cpu
                        int     cpu.sys_id 46
                        string  cpu.comment 
                        string  cpu.status on-line

                cpu
                        int     cpu.sys_id 41
                        string  cpu.comment 
                        string  cpu.status on-line

                cpu
                        int     cpu.sys_id 40
                        string  cpu.comment 
                        string  cpu.status on-line

                cpu
                        int     cpu.sys_id 43
                        string  cpu.comment 
                        string  cpu.status on-line

                cpu
                        int     cpu.sys_id 42
                        string  cpu.comment 
                        string  cpu.status on-line

配置Zone的CPU资源

Haining Henry Zhang
此时,如果在Zone1中运行psrinfo命令,会发现只有56个CPU了(8-63),原因是zone1缺省情况下使用了pool_default这个资源池。我们用zonecfg命令,把pool1分配给zone1:

# zonecfg -z zone1

zonecfg:zone1>set pool=pool1
zonecfg:zone1>commit
zonecfg:zone1>exit

# zoneadm –z zone1 reboot

在Zone1重新启动后,我们在这个zone里可以看到只有8个CPU了:

Zone1# psrinfo

0       on-line   since 04/08/2009 14:22:42
1       on-line   since 04/08/2009 14:22:45
2       on-line   since 04/08/2009 14:22:45
3       on-line   since 04/08/2009 14:22:45
4       on-line   since 04/08/2009 14:22:45
5       on-line   since 04/08/2009 14:22:45
6       on-line   since 04/08/2009 14:22:45
7       on-line   since 04/08/2009 14:22:45

动态分配CPU资源

如果需要改变zone1的CPU资源的分配配置,例如需要增加CPU到16个,可以通过重新配置pset1来实现,注意,这个操作可以在不停止zone 的情况下进行:

1)先取消原来pset1的配置:
# poolcfg –dc ‘destroy pset pset1’

2)此时zone1中的CPU数恢复到64个,我们再用命令创建一个包含16个CPU的pset1, 
命令和前述的过程差不多:

# poolcfg -dc 'create pool pool1'
# poolcfg -dc 'create pset pset1 ( uint pset.min=16; uint pset.max=16 )'
# poolcfg -dc 'transfer to pset pset1 ( cpu 0; cpu 1; cpu 2; cpu 3;\
 cpu 4; cpu 5; cpu 6; cpu 7)'
# poolcfg -dc 'transfer to pset pset1 ( cpu 8; cpu 9; cpu 10; cpu 11; \
cpu 12; cpu 13; cpu 14; cpu 15)'
# poolcfg -dc 'associate pool pool1 ( pset pset1 )'
# pooladm –s

3)这时,在zone1中的CPU数目改为16个。

这样,我们就在Solaris 10中实现了通常由硬件实现的CPU资源动态管理功能。JavaFX Demo Game

注意:上述动态调整功能是基于Solaris 10 u6(10/08),之前的版本可能需要重启才能实现配置的更新。

(转载请注明出处:Solaris技术交流)

Pass Internet Canadian Citizenship Test
United States American Citizenship Application Package
United States Citizen and Immigration Application

Thursday Apr 23, 2009

开放存储Amber Road测试(5)

脚本功能

CLI(命令行)和Scirpting(脚本)功能可以帮助我们进行自动管理和配置。CLI界面可以通过SSH客户端登录,交互式地输入命令。BUI的功能基本上可以通过CLI来实现。下面命令列出了SS7110的版本信息:

Last login: Mon Mar  29 01:57:56 2009 from 192.168.0.88
SS7110-71:> configuration version
SS7110-71:configuration version> list
Appliance Name: SS7110-71
Appliance Type: Sun Storage 7110
Appliance Version: 2008.12.20,1-0
First Installed: Wed Dec 17 2008 02:16:16 GMT+0000 (UTC)
Last Updated: Wed Dec 17 2008 02:16:16 GMT+0000 (UTC)
Last Booted: Mon Mar 19 2009 00:14:36 GMT+0000 (UTC)
Appliance Serial Number: fce88887-3a52-c291-c862-ba8869d48350
Chassis Serial Number: 0999QAE848
Software Part Number: Sun Microsystems, Inc. 259-4793-02
Vendor Product ID: urn:uuid:3ae7b446-edd2-11db-8c3c-080020a9ed93
Browser Name: aksh 1.0
Browser Details: aksh
HTTP Server: Apache/2.2.8 (Unix)
SSL Version: OpenSSL 0.9.8a 11 Oct 2005 (+ security patches to 2007-10-13)
Appliance Kit: ak/SUNW,iwashi@2008.11.20,1-0
Operating System: SunOS 5.11 ak/generic@2008.12.20,1-0 64-bit
BIOS: American Megatrends Inc. 080014 08/19/2008
Service Processor: 2.0.2.5
SS7110-71:configuration version> 

(转载请注明出处:Java,JavaFX,Solaris技术交流 )

以下命令可以列出shares的project名称:

SS7110-71:> shares list
cln_test_prj
default
testProject

SS7000系统还提供脚本功能,实现一些处理逻辑,如循环,判断等,以下是打印输出的例子:

SS7110-71:> script
("." to run)> printf ("this is a test\n");
("." to run)> .
this is a test
SS7110-71:>

自动脚本

在某些特定场合下,需要定时执行一些命令,这时就需要通过自动脚本功能。自动脚本功能可以在另一台Solaris机器上运行一个cron作业,然后通过脚本语言执行特定功能。这里最需要解决的一个问题就是SSH登录过程中的密码输入,因为它会使得cron作业停下来等待输入,无法实现自动完成。一种较好的办法是通过SSH的public key机制,实现无口令登录,从而可以实现自动脚本功能。

在运行脚本cron作业的Solaris客户机中,用ssh-keygen工具可以生成public key,然后通过CLI可以上载到SS7000的SSH key中。步骤如下:

1.在客户机Solaris的命令行下运行命令:

$ ssh-keygen -t rsa -N ""
Generating public/private rsa key pair.
Enter file in which to save the key (/export/home/demouser/.ssh/id_rsa): 
Your identification has been saved in /export/home/demouser/.ssh/id_rsa.
Your public key has been saved in /export/home/demouser/.ssh/id_rsa.pub.
The key fingerprint is:
8a:cd:32:7f:23:9b:49:0e:e7:98:5b:27:40:ae:31:2f demouser@testmachine
2.察看$HOME/.ssh/id_rsa.pub的内容:
$ cat .ssh/id_rsa.pub
ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAIEAwSDguDQfWrMpgSbKHhsNZzlGB/
xNa7D1och29YgM8g6NX4wB36cQ0sjJrjmVPC5oEFk8uGhFrHQT1Eka2zImVwcc
wa9CsHLvZwCX87hA7tj3o8NdF3WPkWUm8asnqAvY8ZkBffCIuFlA//CGIdmNWM
RQT5IhW53+3/p1Dtybcq0= demouser@testmachine

以上内容在一行之中。

3.在SS7000的BUI中,选择Configuration->Preferences中,选择增加SSH Public Keys,把字符串“AAAA…bcq0=”作为key填入,确认即可。

4.登录SS7000检查配置是否成功:

$ ssh -l root 192.168.0.71

SS7110-171:>
无需密码即可登录。

定时产生克隆的文件系统

客户的需求是实时地把数据从一台SS7000复制到另一台SS7000中,起到数据备份的作用。另一方面,复制到目标的数据希望尽快的可以供一个查询应用使用(只读)。我们在配置一个连续(continuous)的复制关系后,可以通过脚本定期clone出一个文件系统来实现只读的拷贝。我们可以编写一个脚本,可以实现上述功能: Canadian Citizenship Practice Exam

$cat clone.txt

confirm shares destroy fsclone

shares replication
select source-000
select testProject
set target_project=fsclone
set override_mountpoint=true
set mountpoint=/export/fsclone
confirm clone
quit

在脚本中,我们先取消原来克隆出来的项目fsclone,然后再重新生成这个fsclone项目,从而实现了更新数据的共享。脚本中的confirm是自动确认一些需要输入Y/N的地方,使得脚本可以自动进行下去。

(转载请注明出处:Java,JavaFX,Solaris技术交流 http://developers.sun.com.cn/blog/henry/ ) United States citizenship Interview exam Question

可以通过cron定时(如隔1小时)执行以下命令:

ssh –l root -T 129.200.9.171 < clone.txt

结论

SS7000存储集成了多种数据服务功能,可以通过简单的图形界面实现绝大多数的管理和配置工作。SS7000提供了简洁的数据复制功能,可以通过IP网络方便的实现数据的远程复制。同时,对LDAP,NIS和AD的支持大大提高了对应用环境的兼容性。其它优秀的功能包括支持脚本运行来实现和完善设备的自动管理,具有强大的系统监控和分析功能等。

(转载请注明出处:Java,JavaFX,Solaris技术交流 http://developers.sun.com.cn/blog/henry/)
Obtain American Citizen United States
U.S. Citizenship Application Help Questions

Wednesday Apr 22, 2009

开放存储Amber Road测试(4)

复制功能

数据复制功能是本次测试的目标之一,我们把数据从一个SS7110复制到另一个SS7410中。尽管它们是两个不同型号的设备,但是因为都是ZFS来实现的,所以可以互相复制数据。

在Shares-〉projects->Replication菜单中,可以增加复制目标。注意,复制是以project为单位来进行的。因此,具有相同复制策略的数据可以归类到同一个project 下。在对话框中输入目标设备的IP地址和root密码,并选择连续复制还是定期复制。连续复制是尽可能及时的把数据复制到目标,定期复制则是在特定的时刻启动复制。Pass Canadian Citizenship Exam

我们选择连续复制,以便数据能够及时复制到目标存储上。此时可以看见复制关系已经建立,并且进度条显示正在作第一次的初始化复制。

当初始化完成后,可以从目标存储上察看状态。这时从目标设备的Shares->Replication菜单中,可以看到有一个从源设备复制过来的同名项目testProject。 American citizenship Application Information

正在复制的数据是不可以使用的,因此,目标存储可以通过Clone功能( 图标)来创建一个可以读写的拷贝。Clone出来的数据就是一个完整的project,可以象其它project一样使用。[注:Clone功能就是基于ZFS的clone命令实现的。] Pass US Citizenship Exam

在数据灾备考虑时,可以在源设备失效后,可以在目标设备中提供原来生产的数据。或者可以通过反向复制功能,把数据从目标设备回传至源设备。在作反向复制时,需要先停止正在进行的复制动作。

用户管理

在SS7000中可以配置管理用户的权限。通过Configuration-〉Users菜单,可以给用户赋予管理员的各种特权。用户可以使本地用户,也可以是目录服务器上的用户。JavaFX Demo Game

分析功能

用DTrace实现的分析功能是SS7000存储的一大功能特色。在Dashboard中,可以看到各部件(如CPU、磁盘等)和各种服务(如NFS,CIFS等)的工作情况:

在点击某个图表后,还可以进一步察看详细的系统状态,可以分时段、分应用等来细化图表。Worksheet功能可以让我们保留察看的数据结果:Demo JavaFX JavaFX Blogs Sample

(转载请注明出处:Java,JavaFX,Solaris技术交流 http://developers.sun.com.cn/blog/henry/)
Online Canadian Citizenship Practice Test
Apply for American Citizenship United States
U.S. Citizenship Application package

Tuesday Apr 21, 2009

开放存储Amber Road测试(3)

NFS

从一台Solaris服务器中用mount 命令可以把SS7000的目录挂接上,或者更加简单的命令:

# cd /net/192.168.0.71/export/filesystem1

用cp/vi/rm等命令测试文件创建读写、删除等功能。[注:NFS功能和标准的Solaris的mount/umount没有太大区别,有关权限的设置可以参考Solaris手册从BUI中配置。]

CIFS

CIFS是Windows平台的文件协议,我们分别从一台Windows XP和Windows Vista客户机上进行连接测试。在资源管理器中输入:\\192.168.0.71\ , 输入用户名/密码后,可以看到共享出来的目录。进入filesystem1目录后,可以看到刚才通过NFS创建的文件。剩下的操作和Windows的本地目录没有什么两样,拖拽、拷贝、删除都可以顺利进行。测试中文文件名也可正常读写。 JavaFX blogs

注:
1.资源管理器中只能输入IP,不能加上目录名。
2.用户必需是SS7000的本地用户或者AD上的用户,NIS/LDAP用户不支持。

FTP

用命令行的ftp客户端可以连接SS7000的FTP服务,此时,可以用LDAP中的用户来认证登录。

c:\>ftp 192.168.0.71
Connected to 192.168.0.71.
220 ProFTPD Server
User (192.168.0.71:(none)): testuser
331 Password required for testuser
Password:
230 User testuser logged in
ftp>

(转载请注明出处:Java技术交流 Canadian Citizenship Interview Question)

HTTP/WEBDAV

通过浏览器,可以访问并下载SS7000上的文件。在浏览器中输入 http://192.168.0.71/shares/export/filesystem1 即可看到相关的文件列表。点击文件列表可以下载。HTTP服务是只读的操作。另外,通过Windows客户端上的web folder服务,可以实现读写功能。 United States Citizenship Application Question

iSCSI

iSCSI协议的配置和使用的步骤如下:

首先创建LUN。在项目界面下,点击filesystems右侧的LUN菜单,再点击+图标,将弹出一个对话框。输入LUN1的名称,再配置Volume大小为10G。这时,SS7000会为LUN1配置一个IQN来作为该资源的标识,通常需要等待几秒钟,IQN才会从“not yet assigned” 变成一个字符串。 http://www.v-soul.com

客户端通常需要配置iSCSI的软件才可以使用,以Windows为例子,我们需要从MS网站下载“Microsoft iSCSI Initiator”软件安装。在简短的安装之后,启动该软件,可以看到本客户端的Initiator Node Name。这时从Discovery标签中可以发现iSCSI设备,点击Discovery然后点击“Add”键输入SS7000的IP地址:192.168.0.71,缺省端口3260。下一步可在Targets标签中,选中相应的IQN后点击“Logon…”,输入用户名密码和登录设备。 JavaFX Game Demo Coding

此时,一个iSCSI的裸设备已经连接上了。在Windows中,从控制面板-〉管理工具-〉计算机管理-〉磁盘管理,可以看到一块10G的未格式化的磁盘。接下来的工作就是格式化后当作本地盘使用了。

[注:iSCSI盘对客户端来看是个裸设备,实际上是SS7000中ZFS管理的一个LUN。]

(转载请注明出处:Java,JavaFX,Solaris技术交流 http://developers.sun.com.cn/blog/henry/)
Web based Canadian Citizenship Test Practice Question
Internet American Citizenship Application

开放存储Amber Road测试(2)

数据服务

SS7000内置了多种数据服务,包括NFS,CIFS, FTP,iSCSI,HTTP,NDMP等,配置十分简单,直接从Configuration->Services菜单进入即可看见配置界面。这里的配置会成为整个设备的全局配置(global setting),在配置具体服务时,缺省值就在这里设置。可以通过点击开关图标来重新启动服务,或者禁用/启用某个服务。状态图标绿色表示服务正常,橙色表示有故障。

目录服务

启动完数据服务后,我们接下来配置目录服务。目录服务支持NIS,LDAP,AD,以及LDAP/AD之间的mapping关系。[注:NIS/LDAP等目录服务其实就是OpenSolaris 中的Naming Services,在nsswitch.conf中配置。SS7000通过BUI(浏览器)界面帮助我们配置了。]

在配置LDAP目录服务之后,使得LDAP服务器中的用户可以使用SS7000上的FTP/HTTP服务,或者成为SS7000设备管理员。 JavaFX Sample Code

在LDAP配置中,需要配置Base search DN来决定用户搜索的基础节点, 如ou=People, dc=sun,dc=com。Search Scope可以是一层或多层。如果LDAP认证需要搜索权限的话,可以配置proxy用户。在Server栏里增加LDAP服务器的IP地址和端口,如192.168.0.201:389。

需要注意的是,LDAP里用户的schema需要满足RFC 2307标准,LDAP用户至少需要两个schema:posixAccount和shadowAccount。如果当前的LDAP中的用户数据不满足这个条件,需要给用户添加这两个schema,并且补充必需(mandatory)的一些属性,如gid,uid, homedirectory等。

(转载请注明出处:Java,JavaFX,Solaris技术交流 Diecast Model Tank Aircraft)

当LDAP服务配置完成后,LDAP里面的用户就可以直接登录SS7000的设备了。可以用FTP服务来检验。

共享服务

我们接下来配置数据共享功能。数据共享有两种方式:文件系统(file system)和LUN(iSCSI)。在浏览器界面中,从Configuration=〉Shares菜单,可以看到左侧Projects栏,可以通过点击出现深灰色的project列表,此时可以点击”Add…” 来增加项目,每个项目是管理的一个基本单位,也是数据复制的基本单位。Project之中的属性可以给下属的filesystem和LUN继承:

我们先输入一个testProject项目名,确认并创建该项目。然后点击Filesystems的"+"图标,增加所需要的文件系统filesystem1. [注意:如果需要支持中文文件名称,需要去掉“Reject non UTF-8”选项,并且要选择”Case sensitivity”为Sensitive。]

Become Canadian Citizen 此时,文件系统filesystem1已经创建,mountpoint(挂接点)为 /export/filesystem1。 这时我们可以点击铅笔图标来进一步客户化,选择“Protocols”配置各种数据服务的参数:

各种服务的属性都是缺省从project中继承下来的,可以根据需要改变。我们把NFS设为Read/Write模式,CIFS的Resource Name设为filesystem1。[注:CIFS的Resource Name最好配置,这样可以减少同名冲突。]

接下来我们可以测试各种数据服务的功能了。

(转载请注明出处:Java,JavaFX,Solaris技术交流 http://developers.sun.com.cn/blog/henry/)
Practice Canadian Citizenship Test
American Citizenship United States
U.S. Citizenship Application Kit


Archives
Links
Referrers