Guest User

Untitled

a guest
Feb 13th, 2019
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.76 KB | None | 0 0
  1. public class Database {
  2.  
  3. public static void main(String[] args) throws Exception {
  4.  
  5. // get the execution environment
  6. final StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
  7.  
  8. TypeInformation[] fieldTypes = new TypeInformation[] { LONG_TYPE_INFO, STRING_TYPE_INFO };
  9. RowTypeInfo rowTypeInfo = new RowTypeInfo(fieldTypes);
  10.  
  11. DataStreamSource source = env.createInput(
  12. JDBCInputFormat.buildJDBCInputFormat()
  13. .setDrivername("com.mysql.jdbc.Driver")
  14. .setDBUrl("jdbc:mysql://localhost/log_db")
  15. .setUsername("root")
  16. .setPassword("pass")
  17. .setQuery("select id, SERVER_NAME from ERRORLOG")
  18. .setRowTypeInfo(rowTypeInfo)
  19. .finish()
  20. );
  21. source.print().setParallelism(1);
  22. env.execute("Error Log Data");
  23. }
  24. }
  25.  
  26. mvn exec:java -Dexec.mainClass=com.test.Database
  27.  
  28. 09:15:56,394 INFO org.apache.flink.runtime.taskmanager.Task - Freeing task resources for Source: Custom Source (1$
  29. 4) (41c66a6dfb97e1d024485f473617a342).
  30. 09:15:56,394 INFO org.apache.flink.core.fs.FileSystem - Ensuring all FileSystem streams are closed for Sour$
  31. e: Custom Source (1/4)
  32. 09:15:56,394 INFO org.apache.flink.runtime.taskmanager.Task - Sink: Unnamed (1/1) (5212fc2a570152c58ffe3d39d3d805$
  33. 0) switched from RUNNING to FINISHED.
  34. 09:15:56,394 INFO org.apache.flink.runtime.taskmanager.Task - Freeing task resources for Sink: Unnamed (1/1) (521$
  35. fc2a570152c58ffe3d39d3d805b0).
  36. 09:15:56,394 INFO org.apache.flink.runtime.taskmanager.TaskManager - Un-registering task and sending final execution sta$
  37. e FINISHED to JobManager for task Source: Custom Source (41c66a6dfb97e1d024485f473617a342)
  38. 09:15:56,396 INFO org.apache.flink.runtime.executiongraph.ExecutionGraph - Source: Custom Source (1/4) (41c66a6dfb97e1d024485f$
  39. 73617a342) switched from RUNNING to FINISHED.
  40. 09:15:56,396 INFO org.apache.flink.runtime.client.JobSubmissionClientActor - 02/22/2017 09:15:56 Source: Custom Source(1/4) swi$
  41. ched to FINISHED
  42. 02/22/2017 09:15:56 Source: Custom Source(1/4) switched to FINISHED
  43. 09:15:56,396 INFO org.apache.flink.core.fs.FileSystem - Ensuring all FileSystem streams are closed for Sink$
  44. Unnamed (1/1)
  45. 09:15:56,397 INFO org.apache.flink.runtime.taskmanager.TaskManager - Un-registering task and sending final execution sta$
  46. e FINISHED to JobManager for task Sink: Unnamed (5212fc2a570152c58ffe3d39d3d805b0)
  47. 09:15:56,398 INFO org.apache.flink.runtime.executiongraph.ExecutionGraph - Sink: Unnamed (1/1) (5212fc2a570152c58ffe3d39d3d805$
  48. 0) switched from RUNNING to FINISHED.
  49. 09:15:56,398 INFO org.apache.flink.runtime.executiongraph.ExecutionGraph - Job Socket Window Data (0eb15d61031ede785e7ed21ead2$
  50. ceea) switched from state RUNNING to FINISHED.
  51. 09:15:56,398 INFO org.apache.flink.runtime.client.JobSubmissionClientActor - 02/22/2017 09:15:56 Sink: Unnamed(1/1) switched to
  52. FINISHED
  53. 02/22/2017 09:15:56 Sink: Unnamed(1/1) switched to FINISHED
  54. 09:15:56,405 INFO org.apache.flink.runtime.checkpoint.CheckpointCoordinator - Stopping checkpoint coordinator for job 0eb15d61031$
  55. de785e7ed21ead21ceea
  56. 09:15:56,406 INFO org.apache.flink.runtime.client.JobSubmissionClientActor - Terminate JobClientActor.
  57. 09:15:56,406 INFO org.apache.flink.runtime.client.JobClient - Job execution complete
  58. 09:15:56,408 INFO org.apache.flink.runtime.minicluster.FlinkMiniCluster - Stopping FlinkMiniCluster.
  59. 09:15:56,405 INFO org.apache.flink.runtime.checkpoint.StandaloneCompletedCheckpointStore - Shutting down
Add Comment
Please, Sign In to add comment