Index
- #Kitchen? ?????
- #??
- #Kitchen ????
- #??? ?? ??
- #??
- #??? ?? Job ?? ??
- #?????? ?? Job ????
- #?? ??? ??
- #????
- #????
Kitchen? ?????
Kitchen? Spoon?? ????? XML???? ?????? ???? ??? Job? ?? ? ? ?? ???? ???. ?????, Job? ?????? ???? ????? ?? ????? ???????.
??
?? Sun Microsystems Java Runtime Environment 1.5 ?? ??? ???. ?? http://www.java.com/ ??? JRE? ?? ?? ? ????.
? ?, ????? ??? zip??? ??? ????? ??? ?? ???.
??? ? Kettle ?????? ?? ?? ??? ?? ????. ??? ?? ?????, ??????? ???? ??? ??? ???. ?? ??? ????, Kettle ?????? ?? ?????? ????? ???.
cd Kettle chmod +x *.sh
Kitchen ????
?? ????? Carte? ???? ?? ???? ?????? ????.
- Kitchen.bat: Windows platform?? Kitchen? ??.
- kitchen.sh: Unix platform ? Mac OSX?? Kitchen? ??.
Kitchen Java Runtime Environment ?? 1.5 ??? ?? ?? ??, ?? ?????? ?? ? ? ????.
??? ?? ??
?? ? ? ?? ??? ?? ?? ???.
These are the command line options that you can use.
IMPORTANT NOTES:
Windows ??????, ??? ????("-")? equal("=")? ???? ??? ?? ???. ? ???, 2.2.2 ?? ??? ? ??? ?? ? ? ????.
(Because of this, from version 2.2.2 on, you can also use this format or any combination of /,- and :,=)
????? ??? ??? ?? ??? ???? ?? ?????.
?? ?? ?? ????? ???, ????(quotes or double quotes)? ?????. ??? ??? ??? ??? ???.
/option:value
??? ??? ??? ???.
?? ??
-version
? ??? Kettle? ?? ?????(kettle.kar)? ??? ?????.
???? ??? ?? ??? ?? ?????.
XML ?? ??
--file=XML????
? ??? XML ??? ??? Job? ?????. (.kjb : Kettle Job)
???? ??
-log=???? ??
????? ?? ???. ???? ?? ??(stdout) ???.
???? ??
-level=????
????? ???? Job? ????? ?? ???.
????? ??? ??? ??? ????:
- Error: ??? ???.
- Nothing: ?? ??? ?? ??.
- Minimal: ???? ??? ???.
- Basic: ??? ????.
- Detailed: ??? ????.
- Debug: ??? ???? ?? ??? ??.
- Rowlevel: (row)? ??. ? ??? ?? ???? ?? ? ? ????.
??? ??
-rep=?????
?? ?? ??? ??? ?? ???? ?? ???.
??, -user, -pass, -dir ? -job ??? ??? ??? ???.
???? KETTLE_REPOSITORY ? ? ??? ?? ? ?? ????.
??? ??? ?? ??
-user=?????
??? ???? ??? ???? ??? ?? ???.
??, ???? KETTLE_USER ? ? ??? ?? ? ?? ????.
??? ???? ??
-pass=????
???? ?????? ???? ????.
???? KETTLE_PASSWORD ? ? ??? ?? ? ?? ????.
?? ? ??? Job? ??
-job=Job??
?? ? Job? ????? ???? ?? ? ??? ?????. "-dir" ???? ????? ?? ? ???.
???? ???? ???
-listdir=Y
"-dir" ???? ?? ? ????? ????? ?? ?? ???? ???? ?????.
??? ???? ??
-dir=????
?? ? ???? ????? ?????. ??? ????? ??? ?? ?????.
- ?? ????: /
- ??????: /production/Dimensions
2.2.2 ?? , ?? ????? / (?)? ????? ?????.
??? Job ??? ??
-listjobs=Y
"-dir" ???? ??? ??? ????? ?? ?? Job ???? ?????.
??? ??? ??
-listrep=Y
??? ?? ??? ???? ?????.
??? ??? ??
-norep=Y
???? KETTLE_REPOSITORY, KETTLE_USER, KETTLE_PASSWORD ? ?? ????, Kitchen? ???? ??? ?? ?? ?? ? ????.
?? ??, XML ??? Job? ????? ? ?, ? ??? ?? ? ? ?? ????.
??
Please make sure that you are positioned in the Kettle directory before running the samples below. If you put these scripts into a batch file or shell script, simply do a change directory to the installation directory:
If Kettle was installed on windows on the D:\ drive
D: cd \Kettle
If Kettle was installed in the /product directory on a Unix system:
cd /product/Kettle/
??? ?? Job ?? ??
This example runs a job from file on a windows platform:
kitchen.bat /file:D:\Jobs\updateWarehouse.kjb /level:Basic
This example runs a job from file on a Linux box:
kitchen.sh -file=/PRD/updateWarehouse.kjb -level=Minimal
?????? ?? Job ????
This example runs a job from the repository on a windows platform:
(Enter on a single line without returns...)
kitchen.bat /rep:"Production Repository" /job:"Update dimensions" /dir:/Dimensions /user:matt /pass:somepassword123 /level:Basic
?? ??? ??
If you don't want the output of the file to appear on the screen but rather be put into a log file, you can use redirection.
This example adds the Kitchen output to an ever-growing log file:
kitchen.sh -file="/PRD/updateWarehouse.kjb" --level=Minimal >> /LOG/trans.log
This example writes the Kitchen output to a file that gets overwritten every time:
kitchen.bat /file:C:\PRD\runAll.kjb /level:Basic > C:\LOG\trans.log
????
Kitchen returns an error code based on how the execution went:
- 0 : The job ran without a problem.
- 1 : Errors occurred during processing
- 2 : An unexpected error occurred during loading / running of the job
- 7 : The job couldn't be loaded from XML or the Repository
- 8 : Error loading steps or plugins (error in loading one of the plugins mostly)
- 9 : Command line usage printing
????
Schedule a job on windows
The best way to go at it is to test the command first at the dos prompt.
Then you can use the windows scheduler to launch this command.
Windows versions since Windows 2000 have a GUI for doing this accessible through the control panel. However it's also possible to use the command line to do this:
at 23:30 /every:Monday,Wednesday,Friday "D:\updateWarehouse.bat
To see a list of the scheduled commands simply type:
at
Schedule a job on Unix
First create a shell script that runs all the jobs you need. Then you can schedule this script to run.
On Unix like systems the easiest way to schedule a command is by using the "cron table". You can do this by entering the following command:
crontab -e
Then you can enter the time at which the command needs to be run as well as the command on a single line in the text file that is presented.
The first options are:
- Minute: The minute of the hour, 0-59
- Hour: The hour of the day, 0-23
- Month day: The day of the month, 1-31
- Month: The month of the year, 1-12
- Weekday: The day of the week, 0-6, 0=Sunday
You can specify more then 1 number for each of these values by separating 2 number with a hyphen -. This means an inclusive number range. If you separate the number by commas (,), it means distinct values. If you use * instead of a number, it means: every possible hour, minute, day, month or weekday.
So, if you want to update the dimensions every hour, at 15 and 45 minutes past the hour during the weekdays, you might enter these lines in a crontab:
# # Launches the update of the dimensions in the warehouse # 15,45 * * * 1-5 /PROD/update_dimensions.sh #