Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/json/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Json 无法从CouchDB导入数据_Json_Couchdb_Couchdb Futon - Fatal编程技术网

Json 无法从CouchDB导入数据

Json 无法从CouchDB导入数据,json,couchdb,couchdb-futon,Json,Couchdb,Couchdb Futon,我正在尝试导入数据,然后将数据导出到远程计算机。下面是数据库的模式。这只是一个我以json格式获得的文档 {"docs":[ {"id":"702decba698fea7df3fa46fdd9000fa4","key":"702decba698fea7df3fa46fdd9000fa4","value":{"rev":"1-f8c63611d5bc7354cac42d2a697ad57a"},"doc":{"_id":"702decba698fea7df3fa46fdd9000fa4","_re

我正在尝试导入数据,然后将数据导出到远程计算机。下面是数据库的模式。这只是一个我以json格式获得的文档

{"docs":[
{"id":"702decba698fea7df3fa46fdd9000fa4","key":"702decba698fea7df3fa46fdd9000fa4","value":{"rev":"1-f8c63611d5bc7354cac42d2a697ad57a"},"doc":{"_id":"702decba698fea7df3fa46fdd9000fa4","_rev":"1-f8c63611d5bc7354cac42d2a697ad57a","contributors":null,"truncated":false,"text":"RT @Whistlepodu4Csk: : First time since 1987 World Cup no Asian teams in the WC final\nThis had occurred in 1975, 1979, 1987 and now #CWC15\n…","in_reply_to_status_id":null,"in_reply_to_user_id":null,"id":583090814735155201,"favorite_count":0,"author":{"py/object":"tweepy.models.User","py/state":{"follow_request_sent":false,"profile_use_background_image":true,"profile_text_color":"333333","id":3102321084,"verified":false,"profile_location":null,"profile_image_url_https":"https://pbs.twimg.com/profile_images/579460416977252352/weSzVnPF_normal.jpg","profile_sidebar_fill_color":"DDEEF6","is_translator":false,"geo_enabled":false,"entities":{"description":{"urls":[]}},"followers_count":1,"profile_sidebar_border_color":"C0DEED","id_str":"3102321084","default_profile_image":false,"location":"Chennai","is_translation_enabled":false,"utc_offset":null,"statuses_count":9,"description":"12/11","friends_count":23,"profile_link_color":"0084B4","profile_image_url":"http://pbs.twimg.com/profile_images/579460416977252352/weSzVnPF_normal.jpg","notifications":false,"profile_background_image_url_https":"https://abs.twimg.com/images/themes/theme1/bg.png","profile_background_color":"C0DEED","profile_background_image_url":"http://abs.twimg.com/images/themes/theme1/bg.png","name":"charandevaa","lang":"en","profile_background_tile":false,"favourites_count":7,"screen_name":"charandevaarg","url":null,"created_at":{"py/object":"datetime.datetime","__reduce__":[{"py/type":"datetime.datetime"},["B98DFgEtLgAAAA=="]]},"contributors_enabled":false,"time_zone":null,"protected":false,"default_profile":true,"following":false,"listed_count":0}},"retweeted":false,"coordinates":null,"entities":{"symbols":[],"user_mentions":[{"indices":[3,19],"id_str":"570379002","screen_name":"Whistlepodu4Csk","name":"Chennai Super Kings","id":570379002}],"hashtags":[{"indices":[132,138],"text":"CWC15"},{"indices":[139,140],"text":"IndvsAus"}],"urls":[]},"in_reply_to_screen_name":null,"id_str":"583090814735155201","retweet_count":9,"metadata":{"iso_language_code":"en","result_type":"recent"},"favorited":false,"retweeted_status":{"py/object":"tweepy.models.Status","py/state":{"contributors":null,"truncated":false,"text":": First time since 1987 World Cup no Asian teams in the WC final\nThis had occurred in 1975, 1979, 1987 and now #CWC15\n#IndvsAus\"","in_reply_to_status_id":null,"in_reply_to_user_id":null,"id":581059988317073409,"favorite_count":6,"author":{"py/object":"tweepy.models.User","py/state":{"follow_request_sent":false,"profile_use_background_image":true,"profile_text_color":"333333","id":570379002,"verified":false,"profile_location":null,"profile_image_url_https":"https://pbs.twimg.com/profile_images/460329225124188160/FgnIhlVM_normal.jpeg","profile_sidebar_fill_color":"DDEEF6","is_translator":false,"geo_enabled":false,"entities":{"url":{"urls":[{"indices":[0,22],"url":"http://t.co/Kx3erXpkEJ","expanded_url":"http://chennaisuperkings.com","display_url":"chennaisuperkings.com"}]},"description":{"urls":[{"indices":[138,160],"url":"http://t.co/yfitkkfz5D","expanded_url":"http://www.facebook.com/chennaisuperkingsofficialfansclub","display_url":"facebook.com/chennaisuperki…"}]}},"followers_count":13604,"profile_sidebar_border_color":"000000","id_str":"570379002","default_profile_image":false,"location":"Chennai","is_translation_enabled":false,"utc_offset":19800,"statuses_count":13107,"description":"Chennai super kings fans club:All about Mahi, Raina,Mccullum,Aswhin,Bravo. Updates about Suriya: Beleive in CSK: Whistlepodu!Suriya Rocks http://t.co/yfitkkfz5D","friends_count":11962,"profile_link_color":"CCC200","profile_image_url":"http://pbs.twimg.com/profile_images/460329225124188160/FgnIhlVM_normal.jpeg","notifications":false,"profile_background_image_url_https":"https://pbs.twimg.com/profile_background_images/518467484358164480/yUXQYv3m.jpeg","profile_background_color":"FFF04D","profile_banner_url":"https://pbs.twimg.com/profile_banners/570379002/1370113848","profile_background_image_url":"http://pbs.twimg.com/profile_background_images/518467484358164480/yUXQYv3m.jpeg","name":"Chennai Super Kings","lang":"en","profile_background_tile":true,"favourites_count":283,"screen_name":"Whistlepodu4Csk","url":"http://t.co/Kx3erXpkEJ","created_at":{"py/object":"datetime.datetime","__reduce__":[{"py/type":"datetime.datetime"},["B9wFAxUWFAAAAA=="]]},"contributors_enabled":false,"time_zone":"Chennai","protected":false,"default_profile":false,"following":false,"listed_count":23}},"retweeted":false,"coordinates":null,"entities":{"symbols":[],"user_mentions":[],"hashtags":[{"indices":[111,117],"text":"CWC15"},{"indices":[118,127],"text":"IndvsAus"}],"urls":[]},"in_reply_to_screen_name":null,"id_str":"581059988317073409","retweet_count":9,"metadata":{"iso_language_code":"en","result_type":"recent"},"favorited":false,"source_url":"http://twitter.com/download/android","user":{"py/id":13},"geo":null,"in_reply_to_user_id_str":null,"lang":"en","created_at":{"py/object":"datetime.datetime","__reduce__":[{"py/type":"datetime.datetime"},["B98DGgsvMwAAAA=="]]},"in_reply_to_status_id_str":null,"place":null,"source":"Twitter for Android"}},"source_url":"http://www.twitter.com","user":{"py/id":1},"geo":null,"in_reply_to_user_id_str":null,"lang":"en","doc_type":"tweet","created_at":{"py/object":"datetime.datetime","__reduce__":[{"py/type":"datetime.datetime"},["B98EAQIRJgAAAA=="]]},"in_reply_to_status_id_str":null,"place":null,"source":"Twitter for Windows Phone"}}]}
方法1:

命令如下:

curl -d @db.json -H "Content-type: application/json" -X POST http://127.0.0.1:5984/cwc15/_bulk_docs
我得到以下错误:

{"error":"not_found","reason":"no_db_file"}
在我发布此问题之前,我确实遵循了以下帖子-

https://www.google.com.au/url?sa=t&rct=j&q=&esrc=s&source=web&cd=4&cad=rja&uact=8&ved=0CC4QFjAD&url=http%3A%2F%2Fstackoverflow.com%2Fquestions%2F26264647%2Fcouchdb-exported-file-wont-import-back-into-database&ei=8GMbVY3eNNjo8AW18YL4BA&usg=AFQjCNHdm1o0NS49nKPrEl0zU-n7eVRv8Q&bvm=bv.89744112,d.dGc
我没有得到谷歌的任何帮助。我在那里看到的最后一篇文章是在2012年,我找不到任何好的帮助。谁能帮我一下吗。我可以成为我的救生员

方法2-

curl -H 'Content-Type: application/json' -X POST http://localhost:5984/_replicate -d ' {"source": "http://example.com:5984/dbname/", "target": "http://localhost@:5984/dbname/"}'
提供了我想要复制的源和目标。在target中,给出了该机器的IP地址,后跟端口号/dbname/

获取错误:
Connection Timedout

方法3:

  • 已导出文件名为-cwc15.coach的coach数据库

  • 存储在闪存驱动器中

  • 以root用户身份登录并转到存储此文件的位置

  • 命令-
    cp cwc15.coach/var/lib/couchdb

    获取错误-

    Error:{{case_clause,{{badmatch,
    {error,eaccess}},
        [{couch_file,init,1,
    [{file,"couch_file.erl"},{line,314}]},
        {gen_server,init_it,6,
    [{file,"gen_server.erl"},{line,304}]},
        {proc_lib,init_p_do_apply,3,
            [{file,"proc_lib.erl"},{line,
    239}]}]}},
    [{couch_server.handle_info,2,
    [{file,couch_server.erl"},{line,442}]},
    {gen_server,handle_msg,5,
    [{file,"gen_server.erl"},{line,604}]},
    {proc_lib,init_p_do_apply,3,
    [{file,"proc_lib.erl"},{line,239}]}]}
    
    {gen_server,call,
        [couch_server,
        {open,<<"cwc15>>,
          [{user_ctx,
            {user_ctx,null,
              [<<"_admin">>],
               <<"{couch_httpd_auth,
    default_authentication_handler}">>}}]},
    infinity]}
    
    错误:{{case_子句,{{badmatch,
    {error,eaccess},
    [{coach_文件,init,1,
    [{file,“coach_file.erl”},{line,314}]},
    {gen_server,init_it,6,
    [{file,“gen_server.erl”},{line,304}]},
    {proc_lib,init_p_do_apply,3,
    [{file,“proc_lib.erl”},{line,
    239}]}]}},
    [{coach_server.handle_info,2,
    [{file,coach_server.erl},{line,442}]},
    {gen_server,handle_msg,5,
    [{file,“gen_server.erl”},{line,604}]},
    {proc_lib,init_p_do_apply,3,
    [{file,“proc_lib.erl”},{line,239}]}
    {gen_服务器,呼叫,
    [U服务器,
    {open,
    {“error”:“not_found”,“reason”:“no_db_file”}
    -数据库不存在,您需要先创建它:另外,不要使用
    -d
    curl键上载文件:该参数用于以文本模式发送数据,而二进制参数(
    -t
    -数据二进制
    )JSON是ineed文本格式,但Unicode数据可能在这里扮演魔鬼角色

    对于
    Connection Timedout
    发生错误,因为您指定的URL无法访问源数据库或目标数据库。不确定它们是真实的,但
    localhost@:5984
    看起来不太好。此外,您没有再次创建数据库,因此可能会发生初始错误


    日志中的错误
    {error,eaccess}
    表示您在复制文件时意外破坏了错误的文件权限。请按照下面的步骤进行恢复,并确保没有任何其他内容被破坏。

    谢谢兄弟!我将尝试提供的解决方案。因此,对于第一种方法,我遇到了错误:curl:无法打开“@db.json”!curl:有关详细信息,请尝试“curl--help”或“curl--manual”。可能的错误是什么这里有问题吗?