Configurazione dello storage degli oggetti con Flume

Configurare Flume per memorizzare i dati da varie origini, ad esempio TCP, file, flusso e così via, in modo da renderli persistenti nello storage degli oggetti.

  1. Accedi ad Apache Ambari.
  2. Nella barra degli strumenti laterale, in Servizi selezionare Flume.
  3. Selezionare Config.
  4. Aggiornare flume-conf con i seguenti parametri:
    #list hdfs sources
    hdfs_agent.sources = nc_source
    hdfs_agent.channels = memchannel
    hdfs_agent.sinks = hdfs_write
      
    # configure hdfs-agent source
    hdfs_agent.sources.nc_source.type = netcat
    hdfs_agent.sources.nc_source.bind = 0.0.0.0
    hdfs_agent.sources.nc_source.port = 33333
      
    # properties of hdfs-Cluster1-sink
    hdfs_agent.sinks.hdfs_write.type = hdfs
    hdfs_agent.sinks.hdfs_write.hdfs.path = oci://<compartment>@<tenancy>/new
    hdfs_agent.sinks.hdfs_write.hdfs.roll.Interval = 30
    hdfs_agent.sinks.hdfs_write.hdfs.writeFormat = Text
    hdfs_agent.sinks.hdfs_write.hdfs..fileType = DataStream
      
    hdfs_agent.channels.memchannel.capacity = 100000
    hdfs_agent.channels.memchannel.type = memory
      
    hdfs_agent.sources.hdfs_source.channels = memchannel
    hdfs_agent.sinks.hdfs_write.channel = memchannel
    hdfs_agent.sinks.hdfs_write.hdfs.kerberosPrincipal = flume/<hostname>@<realm>
    hdfs_agent.sinks.hdfs_write.hdfs.kerberosKeytab = /etc/security/keytabs/flume.service.keytab
  5. Esegui:
    head -n 5 log.txt | nc <hostname> <hdfs_agent.sources.nc_source.port>

    Flume persiste i dati dall'origine netcat allo storage degli oggetti nel nuovo bucket secondo la configurazione.